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,1303 @@
1
+ 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";
2
+ var dom = require("./lib/dom");
3
+ var oop = require("./lib/oop");
4
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
5
+ var lang = require("./lib/lang");
6
+ var Range = require("./range").Range;
7
+ var RangeList = require("./range_list").RangeList;
8
+ var HashHandler = require("./keyboard/hash_handler").HashHandler;
9
+ var Tokenizer = require("./tokenizer").Tokenizer;
10
+ var clipboard = require("./clipboard");
11
+ var VARIABLES = {
12
+ CURRENT_WORD: function (editor) {
13
+ return editor.session.getTextRange(editor.session.getWordRange());
14
+ },
15
+ SELECTION: function (editor, name, indentation) {
16
+ var text = editor.session.getTextRange();
17
+ if (indentation)
18
+ return text.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
19
+ return text;
20
+ },
21
+ CURRENT_LINE: function (editor) {
22
+ return editor.session.getLine(editor.getCursorPosition().row);
23
+ },
24
+ PREV_LINE: function (editor) {
25
+ return editor.session.getLine(editor.getCursorPosition().row - 1);
26
+ },
27
+ LINE_INDEX: function (editor) {
28
+ return editor.getCursorPosition().row;
29
+ },
30
+ LINE_NUMBER: function (editor) {
31
+ return editor.getCursorPosition().row + 1;
32
+ },
33
+ SOFT_TABS: function (editor) {
34
+ return editor.session.getUseSoftTabs() ? "YES" : "NO";
35
+ },
36
+ TAB_SIZE: function (editor) {
37
+ return editor.session.getTabSize();
38
+ },
39
+ CLIPBOARD: function (editor) {
40
+ return clipboard.getText && clipboard.getText();
41
+ },
42
+ FILENAME: function (editor) {
43
+ return /[^/\\]*$/.exec(this.FILEPATH(editor))[0];
44
+ },
45
+ FILENAME_BASE: function (editor) {
46
+ return /[^/\\]*$/.exec(this.FILEPATH(editor))[0].replace(/\.[^.]*$/, "");
47
+ },
48
+ DIRECTORY: function (editor) {
49
+ return this.FILEPATH(editor).replace(/[^/\\]*$/, "");
50
+ },
51
+ FILEPATH: function (editor) { return "/not implemented.txt"; },
52
+ WORKSPACE_NAME: function () { return "Unknown"; },
53
+ FULLNAME: function () { return "Unknown"; },
54
+ BLOCK_COMMENT_START: function (editor) {
55
+ var mode = editor.session.$mode || {};
56
+ return mode.blockComment && mode.blockComment.start || "";
57
+ },
58
+ BLOCK_COMMENT_END: function (editor) {
59
+ var mode = editor.session.$mode || {};
60
+ return mode.blockComment && mode.blockComment.end || "";
61
+ },
62
+ LINE_COMMENT: function (editor) {
63
+ var mode = editor.session.$mode || {};
64
+ return mode.lineCommentStart || "";
65
+ },
66
+ CURRENT_YEAR: date.bind(null, { year: "numeric" }),
67
+ CURRENT_YEAR_SHORT: date.bind(null, { year: "2-digit" }),
68
+ CURRENT_MONTH: date.bind(null, { month: "numeric" }),
69
+ CURRENT_MONTH_NAME: date.bind(null, { month: "long" }),
70
+ CURRENT_MONTH_NAME_SHORT: date.bind(null, { month: "short" }),
71
+ CURRENT_DATE: date.bind(null, { day: "2-digit" }),
72
+ CURRENT_DAY_NAME: date.bind(null, { weekday: "long" }),
73
+ CURRENT_DAY_NAME_SHORT: date.bind(null, { weekday: "short" }),
74
+ CURRENT_HOUR: date.bind(null, { hour: "2-digit", hour12: false }),
75
+ CURRENT_MINUTE: date.bind(null, { minute: "2-digit" }),
76
+ CURRENT_SECOND: date.bind(null, { second: "2-digit" })
77
+ };
78
+ VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
79
+ function date(dateFormat) {
80
+ var str = new Date().toLocaleString("en-us", dateFormat);
81
+ return str.length == 1 ? "0" + str : str;
82
+ }
83
+ var SnippetManager = /** @class */ (function () {
84
+ function SnippetManager() {
85
+ this.snippetMap = {};
86
+ this.snippetNameMap = {};
87
+ this.variables = VARIABLES;
88
+ }
89
+ SnippetManager.prototype.getTokenizer = function () {
90
+ return SnippetManager["$tokenizer"] || this.createTokenizer();
91
+ };
92
+ SnippetManager.prototype.createTokenizer = function () {
93
+ function TabstopToken(str) {
94
+ str = str.substr(1);
95
+ if (/^\d+$/.test(str))
96
+ return [{ tabstopId: parseInt(str, 10) }];
97
+ return [{ text: str }];
98
+ }
99
+ function escape(ch) {
100
+ return "(?:[^\\\\" + ch + "]|\\\\.)";
101
+ }
102
+ var formatMatcher = {
103
+ regex: "/(" + escape("/") + "+)/",
104
+ onMatch: function (val, state, stack) {
105
+ var ts = stack[0];
106
+ ts.fmtString = true;
107
+ ts.guard = val.slice(1, -1);
108
+ ts.flag = "";
109
+ return "";
110
+ },
111
+ next: "formatString"
112
+ };
113
+ SnippetManager["$tokenizer"] = new Tokenizer({
114
+ start: [
115
+ { regex: /\\./, onMatch: function (val, state, stack) {
116
+ var ch = val[1];
117
+ if (ch == "}" && stack.length) {
118
+ val = ch;
119
+ }
120
+ else if ("`$\\".indexOf(ch) != -1) {
121
+ val = ch;
122
+ }
123
+ return [val];
124
+ } },
125
+ { regex: /}/, onMatch: function (val, state, stack) {
126
+ return [stack.length ? stack.shift() : val];
127
+ } },
128
+ { regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken },
129
+ { regex: /\$\{[\dA-Z_a-z]+/, onMatch: function (str, state, stack) {
130
+ var t = TabstopToken(str.substr(1));
131
+ stack.unshift(t[0]);
132
+ return t;
133
+ }, next: "snippetVar" },
134
+ { regex: /\n/, token: "newline", merge: false }
135
+ ],
136
+ snippetVar: [
137
+ { regex: "\\|" + escape("\\|") + "*\\|", onMatch: function (val, state, stack) {
138
+ var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function (operator) {
139
+ return operator.length == 2 ? operator[1] : "\x00";
140
+ }).split("\x00").map(function (value) {
141
+ return { value: value };
142
+ });
143
+ stack[0].choices = choices;
144
+ return [choices[0]];
145
+ }, next: "start" },
146
+ formatMatcher,
147
+ { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start" }
148
+ ],
149
+ formatString: [
150
+ { regex: /:/, onMatch: function (val, state, stack) {
151
+ if (stack.length && stack[0].expectElse) {
152
+ stack[0].expectElse = false;
153
+ stack[0].ifEnd = { elseEnd: stack[0] };
154
+ return [stack[0].ifEnd];
155
+ }
156
+ return ":";
157
+ } },
158
+ { regex: /\\./, onMatch: function (val, state, stack) {
159
+ var ch = val[1];
160
+ if (ch == "}" && stack.length)
161
+ val = ch;
162
+ else if ("`$\\".indexOf(ch) != -1)
163
+ val = ch;
164
+ else if (ch == "n")
165
+ val = "\n";
166
+ else if (ch == "t")
167
+ val = "\t";
168
+ else if ("ulULE".indexOf(ch) != -1)
169
+ val = { changeCase: ch, local: ch > "a" };
170
+ return [val];
171
+ } },
172
+ { regex: "/\\w*}", onMatch: function (val, state, stack) {
173
+ var next = stack.shift();
174
+ if (next)
175
+ next.flag = val.slice(1, -1);
176
+ this.next = next && next.tabstopId ? "start" : "";
177
+ return [next || val];
178
+ }, next: "start" },
179
+ { regex: /\$(?:\d+|\w+)/, onMatch: function (val, state, stack) {
180
+ return [{ text: val.slice(1) }];
181
+ } },
182
+ { regex: /\${\w+/, onMatch: function (val, state, stack) {
183
+ var token = { text: val.slice(2) };
184
+ stack.unshift(token);
185
+ return [token];
186
+ }, next: "formatStringVar" },
187
+ { regex: /\n/, token: "newline", merge: false },
188
+ { regex: /}/, onMatch: function (val, state, stack) {
189
+ var next = stack.shift();
190
+ this.next = next && next.tabstopId ? "start" : "";
191
+ return [next || val];
192
+ }, next: "start" }
193
+ ],
194
+ formatStringVar: [
195
+ { regex: /:\/\w+}/, onMatch: function (val, state, stack) {
196
+ var ts = stack[0];
197
+ ts.formatFunction = val.slice(2, -1);
198
+ return [stack.shift()];
199
+ }, next: "formatString" },
200
+ formatMatcher,
201
+ { regex: /:[\?\-+]?/, onMatch: function (val, state, stack) {
202
+ if (val[1] == "+")
203
+ stack[0].ifEnd = stack[0];
204
+ if (val[1] == "?")
205
+ stack[0].expectElse = true;
206
+ }, next: "formatString" },
207
+ { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString" }
208
+ ]
209
+ });
210
+ return SnippetManager["$tokenizer"];
211
+ };
212
+ SnippetManager.prototype.tokenizeTmSnippet = function (str, startState) {
213
+ return this.getTokenizer().getLineTokens(str, startState).tokens.map(function (x) {
214
+ return x.value || x;
215
+ });
216
+ };
217
+ SnippetManager.prototype.getVariableValue = function (editor, name, indentation) {
218
+ if (/^\d+$/.test(name))
219
+ return (this.variables.__ || {})[name] || "";
220
+ if (/^[A-Z]\d+$/.test(name))
221
+ return (this.variables[name[0] + "__"] || {})[name.substr(1)] || "";
222
+ name = name.replace(/^TM_/, "");
223
+ if (!this.variables.hasOwnProperty(name))
224
+ return "";
225
+ var value = this.variables[name];
226
+ if (typeof value == "function")
227
+ value = this.variables[name](editor, name, indentation);
228
+ return value == null ? "" : value;
229
+ };
230
+ SnippetManager.prototype.tmStrFormat = function (str, ch, editor) {
231
+ if (!ch.fmt)
232
+ return str;
233
+ var flag = ch.flag || "";
234
+ var re = ch.guard;
235
+ re = new RegExp(re, flag.replace(/[^gim]/g, ""));
236
+ var fmtTokens = typeof ch.fmt == "string" ? this.tokenizeTmSnippet(ch.fmt, "formatString") : ch.fmt;
237
+ var _self = this;
238
+ var formatted = str.replace(re, function () {
239
+ var oldArgs = _self.variables.__;
240
+ _self.variables.__ = [].slice.call(arguments);
241
+ var fmtParts = _self.resolveVariables(fmtTokens, editor);
242
+ var gChangeCase = "E";
243
+ for (var i = 0; i < fmtParts.length; i++) {
244
+ var ch = fmtParts[i];
245
+ if (typeof ch == "object") {
246
+ fmtParts[i] = "";
247
+ if (ch.changeCase && ch.local) {
248
+ var next = fmtParts[i + 1];
249
+ if (next && typeof next == "string") {
250
+ if (ch.changeCase == "u")
251
+ fmtParts[i] = next[0].toUpperCase();
252
+ else
253
+ fmtParts[i] = next[0].toLowerCase();
254
+ fmtParts[i + 1] = next.substr(1);
255
+ }
256
+ }
257
+ else if (ch.changeCase) {
258
+ gChangeCase = ch.changeCase;
259
+ }
260
+ }
261
+ else if (gChangeCase == "U") {
262
+ fmtParts[i] = ch.toUpperCase();
263
+ }
264
+ else if (gChangeCase == "L") {
265
+ fmtParts[i] = ch.toLowerCase();
266
+ }
267
+ }
268
+ _self.variables.__ = oldArgs;
269
+ return fmtParts.join("");
270
+ });
271
+ return formatted;
272
+ };
273
+ SnippetManager.prototype.tmFormatFunction = function (str, ch, editor) {
274
+ if (ch.formatFunction == "upcase")
275
+ return str.toUpperCase();
276
+ if (ch.formatFunction == "downcase")
277
+ return str.toLowerCase();
278
+ return str;
279
+ };
280
+ SnippetManager.prototype.resolveVariables = function (snippet, editor) {
281
+ var result = [];
282
+ var indentation = "";
283
+ var afterNewLine = true;
284
+ for (var i = 0; i < snippet.length; i++) {
285
+ var ch = snippet[i];
286
+ if (typeof ch == "string") {
287
+ result.push(ch);
288
+ if (ch == "\n") {
289
+ afterNewLine = true;
290
+ indentation = "";
291
+ }
292
+ else if (afterNewLine) {
293
+ indentation = /^\t*/.exec(ch)[0];
294
+ afterNewLine = /\S/.test(ch);
295
+ }
296
+ continue;
297
+ }
298
+ if (!ch)
299
+ continue;
300
+ afterNewLine = false;
301
+ if (ch.fmtString) {
302
+ var j = snippet.indexOf(ch, i + 1);
303
+ if (j == -1)
304
+ j = snippet.length;
305
+ ch.fmt = snippet.slice(i + 1, j);
306
+ i = j;
307
+ }
308
+ if (ch.text) {
309
+ var value = this.getVariableValue(editor, ch.text, indentation) + "";
310
+ if (ch.fmtString)
311
+ value = this.tmStrFormat(value, ch, editor);
312
+ if (ch.formatFunction)
313
+ value = this.tmFormatFunction(value, ch, editor);
314
+ if (value && !ch.ifEnd) {
315
+ result.push(value);
316
+ gotoNext(ch);
317
+ }
318
+ else if (!value && ch.ifEnd) {
319
+ gotoNext(ch.ifEnd);
320
+ }
321
+ }
322
+ else if (ch.elseEnd) {
323
+ gotoNext(ch.elseEnd);
324
+ }
325
+ else if (ch.tabstopId != null) {
326
+ result.push(ch);
327
+ }
328
+ else if (ch.changeCase != null) {
329
+ result.push(ch);
330
+ }
331
+ }
332
+ function gotoNext(ch) {
333
+ var i1 = snippet.indexOf(ch, i + 1);
334
+ if (i1 != -1)
335
+ i = i1;
336
+ }
337
+ return result;
338
+ };
339
+ SnippetManager.prototype.getDisplayTextForSnippet = function (editor, snippetText) {
340
+ var processedSnippet = processSnippetText.call(this, editor, snippetText);
341
+ return processedSnippet.text;
342
+ };
343
+ SnippetManager.prototype.insertSnippetForSelection = function (editor, snippetText, options) {
344
+ if (options === void 0) { options = {}; }
345
+ var processedSnippet = processSnippetText.call(this, editor, snippetText, options);
346
+ var range = editor.getSelectionRange();
347
+ var end = editor.session.replace(range, processedSnippet.text);
348
+ var tabstopManager = new TabstopManager(editor);
349
+ var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
350
+ tabstopManager.addTabstops(processedSnippet.tabstops, range.start, end, selectionId);
351
+ };
352
+ SnippetManager.prototype.insertSnippet = function (editor, snippetText, options) {
353
+ if (options === void 0) { options = {}; }
354
+ var self = this;
355
+ if (editor.inVirtualSelectionMode)
356
+ return self.insertSnippetForSelection(editor, snippetText, options);
357
+ editor.forEachSelection(function () {
358
+ self.insertSnippetForSelection(editor, snippetText, options);
359
+ }, null, { keepOrder: true });
360
+ if (editor.tabstopManager)
361
+ editor.tabstopManager.tabNext();
362
+ };
363
+ SnippetManager.prototype.$getScope = function (editor) {
364
+ var scope = editor.session.$mode.$id || "";
365
+ scope = scope.split("/").pop();
366
+ if (scope === "html" || scope === "php") {
367
+ if (scope === "php" && !editor.session.$mode.inlinePhp)
368
+ scope = "html";
369
+ var c = editor.getCursorPosition();
370
+ var state = editor.session.getState(c.row);
371
+ if (typeof state === "object") {
372
+ state = state[0];
373
+ }
374
+ if (state.substring) {
375
+ if (state.substring(0, 3) == "js-")
376
+ scope = "javascript";
377
+ else if (state.substring(0, 4) == "css-")
378
+ scope = "css";
379
+ else if (state.substring(0, 4) == "php-")
380
+ scope = "php";
381
+ }
382
+ }
383
+ return scope;
384
+ };
385
+ SnippetManager.prototype.getActiveScopes = function (editor) {
386
+ var scope = this.$getScope(editor);
387
+ var scopes = [scope];
388
+ var snippetMap = this.snippetMap;
389
+ if (snippetMap[scope] && snippetMap[scope].includeScopes) {
390
+ scopes.push.apply(scopes, snippetMap[scope].includeScopes);
391
+ }
392
+ scopes.push("_");
393
+ return scopes;
394
+ };
395
+ SnippetManager.prototype.expandWithTab = function (editor, options) {
396
+ var self = this;
397
+ var result = editor.forEachSelection(function () {
398
+ return self.expandSnippetForSelection(editor, options);
399
+ }, null, { keepOrder: true });
400
+ if (result && editor.tabstopManager)
401
+ editor.tabstopManager.tabNext();
402
+ return result;
403
+ };
404
+ SnippetManager.prototype.expandSnippetForSelection = function (editor, options) {
405
+ var cursor = editor.getCursorPosition();
406
+ var line = editor.session.getLine(cursor.row);
407
+ var before = line.substring(0, cursor.column);
408
+ var after = line.substr(cursor.column);
409
+ var snippetMap = this.snippetMap;
410
+ var snippet;
411
+ this.getActiveScopes(editor).some(function (scope) {
412
+ var snippets = snippetMap[scope];
413
+ if (snippets)
414
+ snippet = this.findMatchingSnippet(snippets, before, after);
415
+ return !!snippet;
416
+ }, this);
417
+ if (!snippet)
418
+ return false;
419
+ if (options && options.dryRun)
420
+ return true;
421
+ editor.session.doc.removeInLine(cursor.row, cursor.column - snippet.replaceBefore.length, cursor.column + snippet.replaceAfter.length);
422
+ this.variables.M__ = snippet.matchBefore;
423
+ this.variables.T__ = snippet.matchAfter;
424
+ this.insertSnippetForSelection(editor, snippet.content);
425
+ this.variables.M__ = this.variables.T__ = null;
426
+ return true;
427
+ };
428
+ SnippetManager.prototype.findMatchingSnippet = function (snippetList, before, after) {
429
+ for (var i = snippetList.length; i--;) {
430
+ var s = snippetList[i];
431
+ if (s.startRe && !s.startRe.test(before))
432
+ continue;
433
+ if (s.endRe && !s.endRe.test(after))
434
+ continue;
435
+ if (!s.startRe && !s.endRe)
436
+ continue;
437
+ s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
438
+ s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
439
+ s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
440
+ s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : "";
441
+ return s;
442
+ }
443
+ };
444
+ SnippetManager.prototype.register = function (snippets, scope) {
445
+ var snippetMap = this.snippetMap;
446
+ var snippetNameMap = this.snippetNameMap;
447
+ var self = this;
448
+ if (!snippets)
449
+ snippets = [];
450
+ function wrapRegexp(src) {
451
+ if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
452
+ src = "(?:" + src + ")";
453
+ return src || "";
454
+ }
455
+ function guardedRegexp(re, guard, opening) {
456
+ re = wrapRegexp(re);
457
+ guard = wrapRegexp(guard);
458
+ if (opening) {
459
+ re = guard + re;
460
+ if (re && re[re.length - 1] != "$")
461
+ re = re + "$";
462
+ }
463
+ else {
464
+ re = re + guard;
465
+ if (re && re[0] != "^")
466
+ re = "^" + re;
467
+ }
468
+ return new RegExp(re);
469
+ }
470
+ function addSnippet(s) {
471
+ if (!s.scope)
472
+ s.scope = scope || "_";
473
+ scope = s.scope;
474
+ if (!snippetMap[scope]) {
475
+ snippetMap[scope] = [];
476
+ snippetNameMap[scope] = {};
477
+ }
478
+ var map = snippetNameMap[scope];
479
+ if (s.name) {
480
+ var old = map[s.name];
481
+ if (old)
482
+ self.unregister(old);
483
+ map[s.name] = s;
484
+ }
485
+ snippetMap[scope].push(s);
486
+ if (s.prefix)
487
+ s.tabTrigger = s.prefix;
488
+ if (!s.content && s.body)
489
+ s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
490
+ if (s.tabTrigger && !s.trigger) {
491
+ if (!s.guard && /^\w/.test(s.tabTrigger))
492
+ s.guard = "\\b";
493
+ s.trigger = lang.escapeRegExp(s.tabTrigger);
494
+ }
495
+ if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
496
+ return;
497
+ s.startRe = guardedRegexp(s.trigger, s.guard, true);
498
+ s.triggerRe = new RegExp(s.trigger);
499
+ s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
500
+ s.endTriggerRe = new RegExp(s.endTrigger);
501
+ }
502
+ if (Array.isArray(snippets)) {
503
+ snippets.forEach(addSnippet);
504
+ }
505
+ else {
506
+ Object.keys(snippets).forEach(function (key) {
507
+ addSnippet(snippets[key]);
508
+ });
509
+ }
510
+ this._signal("registerSnippets", { scope: scope });
511
+ };
512
+ SnippetManager.prototype.unregister = function (snippets, scope) {
513
+ var snippetMap = this.snippetMap;
514
+ var snippetNameMap = this.snippetNameMap;
515
+ function removeSnippet(s) {
516
+ var nameMap = snippetNameMap[s.scope || scope];
517
+ if (nameMap && nameMap[s.name]) {
518
+ delete nameMap[s.name];
519
+ var map = snippetMap[s.scope || scope];
520
+ var i = map && map.indexOf(s);
521
+ if (i >= 0)
522
+ map.splice(i, 1);
523
+ }
524
+ }
525
+ if (snippets.content)
526
+ removeSnippet(snippets);
527
+ else if (Array.isArray(snippets))
528
+ snippets.forEach(removeSnippet);
529
+ };
530
+ SnippetManager.prototype.parseSnippetFile = function (str) {
531
+ str = str.replace(/\r/g, "");
532
+ var list = [], /**@type{Snippet}*/ snippet = {};
533
+ var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
534
+ var m;
535
+ while (m = re.exec(str)) {
536
+ if (m[1]) {
537
+ try {
538
+ snippet = JSON.parse(m[1]);
539
+ list.push(snippet);
540
+ }
541
+ catch (e) { }
542
+ }
543
+ if (m[4]) {
544
+ snippet.content = m[4].replace(/^\t/gm, "");
545
+ list.push(snippet);
546
+ snippet = {};
547
+ }
548
+ else {
549
+ var key = m[2], val = m[3];
550
+ if (key == "regex") {
551
+ var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
552
+ snippet.guard = guardRe.exec(val)[1];
553
+ snippet.trigger = guardRe.exec(val)[1];
554
+ snippet.endTrigger = guardRe.exec(val)[1];
555
+ snippet.endGuard = guardRe.exec(val)[1];
556
+ }
557
+ else if (key == "snippet") {
558
+ snippet.tabTrigger = val.match(/^\S*/)[0];
559
+ if (!snippet.name)
560
+ snippet.name = val;
561
+ }
562
+ else if (key) {
563
+ snippet[key] = val;
564
+ }
565
+ }
566
+ }
567
+ return list;
568
+ };
569
+ SnippetManager.prototype.getSnippetByName = function (name, editor) {
570
+ var snippetMap = this.snippetNameMap;
571
+ var snippet;
572
+ this.getActiveScopes(editor).some(function (scope) {
573
+ var snippets = snippetMap[scope];
574
+ if (snippets)
575
+ snippet = snippets[name];
576
+ return !!snippet;
577
+ }, this);
578
+ return snippet;
579
+ };
580
+ return SnippetManager;
581
+ }());
582
+ oop.implement(SnippetManager.prototype, EventEmitter);
583
+ var processSnippetText = function (editor, snippetText, options) {
584
+ if (options === void 0) { options = {}; }
585
+ var cursor = editor.getCursorPosition();
586
+ var line = editor.session.getLine(cursor.row);
587
+ var tabString = editor.session.getTabString();
588
+ var indentString = line.match(/^\s*/)[0];
589
+ if (cursor.column < indentString.length)
590
+ indentString = indentString.slice(0, cursor.column);
591
+ snippetText = snippetText.replace(/\r/g, "");
592
+ var tokens = this.tokenizeTmSnippet(snippetText);
593
+ tokens = this.resolveVariables(tokens, editor);
594
+ tokens = tokens.map(function (x) {
595
+ if (x == "\n" && !options.excludeExtraIndent)
596
+ return x + indentString;
597
+ if (typeof x == "string")
598
+ return x.replace(/\t/g, tabString);
599
+ return x;
600
+ });
601
+ var tabstops = [];
602
+ tokens.forEach(function (p, i) {
603
+ if (typeof p != "object")
604
+ return;
605
+ var id = p.tabstopId;
606
+ var ts = tabstops[id];
607
+ if (!ts) {
608
+ ts = tabstops[id] = [];
609
+ ts.index = id;
610
+ ts.value = "";
611
+ ts.parents = {};
612
+ }
613
+ if (ts.indexOf(p) !== -1)
614
+ return;
615
+ if (p.choices && !ts.choices)
616
+ ts.choices = p.choices;
617
+ ts.push(p);
618
+ var i1 = tokens.indexOf(p, i + 1);
619
+ if (i1 === -1)
620
+ return;
621
+ var value = tokens.slice(i + 1, i1);
622
+ var isNested = value.some(function (t) { return typeof t === "object"; });
623
+ if (isNested && !ts.value) {
624
+ ts.value = value;
625
+ }
626
+ else if (value.length && (!ts.value || typeof ts.value !== "string")) {
627
+ ts.value = value.join("");
628
+ }
629
+ });
630
+ tabstops.forEach(function (ts) { ts.length = 0; });
631
+ var expanding = {};
632
+ function copyValue(val) {
633
+ var copy = [];
634
+ for (var i = 0; i < val.length; i++) {
635
+ var p = val[i];
636
+ if (typeof p == "object") {
637
+ if (expanding[p.tabstopId])
638
+ continue;
639
+ var j = val.lastIndexOf(p, i - 1);
640
+ p = copy[j] || { tabstopId: p.tabstopId };
641
+ }
642
+ copy[i] = p;
643
+ }
644
+ return copy;
645
+ }
646
+ for (var i = 0; i < tokens.length; i++) {
647
+ var p = tokens[i];
648
+ if (typeof p != "object")
649
+ continue;
650
+ var id = p.tabstopId;
651
+ var ts = tabstops[id];
652
+ var i1 = tokens.indexOf(p, i + 1);
653
+ if (expanding[id]) {
654
+ if (expanding[id] === p) {
655
+ delete expanding[id];
656
+ Object.keys(expanding).forEach(function (parentId) {
657
+ ts.parents[parentId] = true;
658
+ });
659
+ }
660
+ continue;
661
+ }
662
+ expanding[id] = p;
663
+ var value = ts.value;
664
+ if (typeof value !== "string")
665
+ value = copyValue(value);
666
+ else if (p.fmt)
667
+ value = this.tmStrFormat(value, p, editor);
668
+ tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
669
+ if (ts.indexOf(p) === -1)
670
+ ts.push(p);
671
+ }
672
+ var row = 0, column = 0;
673
+ var text = "";
674
+ tokens.forEach(function (t) {
675
+ if (typeof t === "string") {
676
+ var lines = t.split("\n");
677
+ if (lines.length > 1) {
678
+ column = lines[lines.length - 1].length;
679
+ row += lines.length - 1;
680
+ }
681
+ else
682
+ column += t.length;
683
+ text += t;
684
+ }
685
+ else if (t) {
686
+ if (!t.start)
687
+ t.start = { row: row, column: column };
688
+ else
689
+ t.end = { row: row, column: column };
690
+ }
691
+ });
692
+ return {
693
+ text: text,
694
+ tabstops: tabstops,
695
+ tokens: tokens
696
+ };
697
+ };
698
+ var TabstopManager = /** @class */ (function () {
699
+ function TabstopManager(editor) {
700
+ this.index = 0;
701
+ this.ranges = [];
702
+ this.tabstops = [];
703
+ if (editor.tabstopManager)
704
+ return editor.tabstopManager;
705
+ editor.tabstopManager = this;
706
+ this.$onChange = this.onChange.bind(this);
707
+ this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
708
+ this.$onChangeSession = this.onChangeSession.bind(this);
709
+ this.$onAfterExec = this.onAfterExec.bind(this);
710
+ this.attach(editor);
711
+ }
712
+ TabstopManager.prototype.attach = function (editor) {
713
+ this.$openTabstops = null;
714
+ this.selectedTabstop = null;
715
+ this.editor = editor;
716
+ this.session = editor.session;
717
+ this.editor.on("change", this.$onChange);
718
+ this.editor.on("changeSelection", this.$onChangeSelection);
719
+ this.editor.on("changeSession", this.$onChangeSession);
720
+ this.editor.commands.on("afterExec", this.$onAfterExec);
721
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
722
+ };
723
+ TabstopManager.prototype.detach = function () {
724
+ this.tabstops.forEach(this.removeTabstopMarkers, this);
725
+ this.ranges.length = 0;
726
+ this.tabstops.length = 0;
727
+ this.selectedTabstop = null;
728
+ this.editor.off("change", this.$onChange);
729
+ this.editor.off("changeSelection", this.$onChangeSelection);
730
+ this.editor.off("changeSession", this.$onChangeSession);
731
+ this.editor.commands.off("afterExec", this.$onAfterExec);
732
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
733
+ this.editor.tabstopManager = null;
734
+ this.session = null;
735
+ this.editor = null;
736
+ };
737
+ TabstopManager.prototype.onChange = function (delta) {
738
+ var isRemove = delta.action[0] == "r";
739
+ var selectedTabstop = this.selectedTabstop || {};
740
+ var parents = selectedTabstop.parents || {};
741
+ var tabstops = this.tabstops.slice();
742
+ for (var i = 0; i < tabstops.length; i++) {
743
+ var ts = tabstops[i];
744
+ var active = ts == selectedTabstop || parents[ts.index];
745
+ ts.rangeList.$bias = active ? 0 : 1;
746
+ if (delta.action == "remove" && ts !== selectedTabstop) {
747
+ var parentActive = ts.parents && ts.parents[selectedTabstop.index];
748
+ var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
749
+ startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
750
+ var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
751
+ endIndex = endIndex < 0 ? -endIndex - 1 : endIndex - 1;
752
+ var toRemove = ts.rangeList.ranges.slice(startIndex, endIndex);
753
+ for (var j = 0; j < toRemove.length; j++)
754
+ this.removeRange(toRemove[j]);
755
+ }
756
+ ts.rangeList.$onChange(delta);
757
+ }
758
+ var session = this.session;
759
+ if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
760
+ this.detach();
761
+ };
762
+ TabstopManager.prototype.updateLinkedFields = function () {
763
+ var ts = this.selectedTabstop;
764
+ if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
765
+ return;
766
+ this.$inChange = true;
767
+ var session = this.session;
768
+ var text = session.getTextRange(ts.firstNonLinked);
769
+ for (var i = 0; i < ts.length; i++) {
770
+ var range = ts[i];
771
+ if (!range.linked)
772
+ continue;
773
+ var original = range.original;
774
+ var fmt = exports.snippetManager.tmStrFormat(text, original, this.editor);
775
+ session.replace(range, fmt);
776
+ }
777
+ this.$inChange = false;
778
+ };
779
+ TabstopManager.prototype.onAfterExec = function (e) {
780
+ if (e.command && !e.command.readOnly)
781
+ this.updateLinkedFields();
782
+ };
783
+ TabstopManager.prototype.onChangeSelection = function () {
784
+ if (!this.editor)
785
+ return;
786
+ var lead = this.editor.selection.lead;
787
+ var anchor = this.editor.selection.anchor;
788
+ var isEmpty = this.editor.selection.isEmpty();
789
+ for (var i = 0; i < this.ranges.length; i++) {
790
+ if (this.ranges[i].linked)
791
+ continue;
792
+ var containsLead = this.ranges[i].contains(lead.row, lead.column);
793
+ var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column);
794
+ if (containsLead && containsAnchor)
795
+ return;
796
+ }
797
+ this.detach();
798
+ };
799
+ TabstopManager.prototype.onChangeSession = function () {
800
+ this.detach();
801
+ };
802
+ TabstopManager.prototype.tabNext = function (dir) {
803
+ var max = this.tabstops.length;
804
+ var index = this.index + (dir || 1);
805
+ index = Math.min(Math.max(index, 1), max);
806
+ if (index == max)
807
+ index = 0;
808
+ this.selectTabstop(index);
809
+ this.updateTabstopMarkers();
810
+ if (index === 0) {
811
+ this.detach();
812
+ }
813
+ };
814
+ TabstopManager.prototype.selectTabstop = function (index) {
815
+ this.$openTabstops = null;
816
+ var ts = this.tabstops[this.index];
817
+ if (ts)
818
+ this.addTabstopMarkers(ts);
819
+ this.index = index;
820
+ ts = this.tabstops[this.index];
821
+ if (!ts || !ts.length)
822
+ return;
823
+ this.selectedTabstop = ts;
824
+ var range = ts.firstNonLinked || ts;
825
+ if (ts.choices)
826
+ range.cursor = range.start;
827
+ if (!this.editor.inVirtualSelectionMode) {
828
+ var sel = this.editor.multiSelect;
829
+ sel.toSingleRange(range);
830
+ for (var i = 0; i < ts.length; i++) {
831
+ if (ts.hasLinkedRanges && ts[i].linked)
832
+ continue;
833
+ sel.addRange(ts[i].clone(), true);
834
+ }
835
+ }
836
+ else {
837
+ this.editor.selection.fromOrientedRange(range);
838
+ }
839
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
840
+ if (this.selectedTabstop && this.selectedTabstop.choices)
841
+ this.editor.execCommand("startAutocomplete", { matches: this.selectedTabstop.choices });
842
+ };
843
+ TabstopManager.prototype.addTabstops = function (tabstops, start, end) {
844
+ var useLink = this.useLink || !this.editor.getOption("enableMultiselect");
845
+ if (!this.$openTabstops)
846
+ this.$openTabstops = [];
847
+ if (!tabstops[0]) {
848
+ var p = Range.fromPoints(end, end);
849
+ moveRelative(p.start, start);
850
+ moveRelative(p.end, start);
851
+ tabstops[0] = [p];
852
+ tabstops[0].index = 0;
853
+ }
854
+ var i = this.index;
855
+ var arg = [i + 1, 0];
856
+ var ranges = this.ranges;
857
+ var snippetId = this.snippetId = (this.snippetId || 0) + 1;
858
+ tabstops.forEach(function (ts, index) {
859
+ var dest = this.$openTabstops[index] || ts;
860
+ dest.snippetId = snippetId;
861
+ for (var i = 0; i < ts.length; i++) {
862
+ var p = ts[i];
863
+ var range = Range.fromPoints(p.start, p.end || p.start);
864
+ movePoint(range.start, start);
865
+ movePoint(range.end, start);
866
+ range.original = p;
867
+ range.tabstop = dest;
868
+ ranges.push(range);
869
+ if (dest != ts)
870
+ dest.unshift(range);
871
+ else
872
+ dest[i] = range;
873
+ if (p.fmtString || (dest.firstNonLinked && useLink)) {
874
+ range.linked = true;
875
+ dest.hasLinkedRanges = true;
876
+ }
877
+ else if (!dest.firstNonLinked)
878
+ dest.firstNonLinked = range;
879
+ }
880
+ if (!dest.firstNonLinked)
881
+ dest.hasLinkedRanges = false;
882
+ if (dest === ts) {
883
+ arg.push(dest);
884
+ this.$openTabstops[index] = dest;
885
+ }
886
+ this.addTabstopMarkers(dest);
887
+ dest.rangeList = dest.rangeList || new RangeList();
888
+ dest.rangeList.$bias = 0;
889
+ dest.rangeList.addList(dest);
890
+ }, this);
891
+ if (arg.length > 2) {
892
+ if (this.tabstops.length)
893
+ arg.push(arg.splice(2, 1)[0]);
894
+ this.tabstops.splice.apply(this.tabstops, arg);
895
+ }
896
+ };
897
+ TabstopManager.prototype.addTabstopMarkers = function (ts) {
898
+ var session = this.session;
899
+ ts.forEach(function (range) {
900
+ if (!range.markerId)
901
+ range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
902
+ });
903
+ };
904
+ TabstopManager.prototype.removeTabstopMarkers = function (ts) {
905
+ var session = this.session;
906
+ ts.forEach(function (range) {
907
+ session.removeMarker(range.markerId);
908
+ range.markerId = null;
909
+ });
910
+ };
911
+ TabstopManager.prototype.updateTabstopMarkers = function () {
912
+ if (!this.selectedTabstop)
913
+ return;
914
+ var currentSnippetId = this.selectedTabstop.snippetId;
915
+ if (this.selectedTabstop.index === 0) {
916
+ currentSnippetId--;
917
+ }
918
+ this.tabstops.forEach(function (ts) {
919
+ if (ts.snippetId === currentSnippetId)
920
+ this.addTabstopMarkers(ts);
921
+ else
922
+ this.removeTabstopMarkers(ts);
923
+ }, this);
924
+ };
925
+ TabstopManager.prototype.removeRange = function (range) {
926
+ var i = range.tabstop.indexOf(range);
927
+ if (i != -1)
928
+ range.tabstop.splice(i, 1);
929
+ i = this.ranges.indexOf(range);
930
+ if (i != -1)
931
+ this.ranges.splice(i, 1);
932
+ i = range.tabstop.rangeList.ranges.indexOf(range);
933
+ if (i != -1)
934
+ range.tabstop.splice(i, 1);
935
+ this.session.removeMarker(range.markerId);
936
+ if (!range.tabstop.length) {
937
+ i = this.tabstops.indexOf(range.tabstop);
938
+ if (i != -1)
939
+ this.tabstops.splice(i, 1);
940
+ if (!this.tabstops.length)
941
+ this.detach();
942
+ }
943
+ };
944
+ return TabstopManager;
945
+ }());
946
+ TabstopManager.prototype.keyboardHandler = new HashHandler();
947
+ TabstopManager.prototype.keyboardHandler.bindKeys({
948
+ "Tab": function (editor) {
949
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
950
+ return;
951
+ editor.tabstopManager.tabNext(1);
952
+ editor.renderer.scrollCursorIntoView();
953
+ },
954
+ "Shift-Tab": function (editor) {
955
+ editor.tabstopManager.tabNext(-1);
956
+ editor.renderer.scrollCursorIntoView();
957
+ },
958
+ "Esc": function (editor) {
959
+ editor.tabstopManager.detach();
960
+ }
961
+ });
962
+ var movePoint = function (point, diff) {
963
+ if (point.row == 0)
964
+ point.column += diff.column;
965
+ point.row += diff.row;
966
+ };
967
+ var moveRelative = function (point, start) {
968
+ if (point.row == start.row)
969
+ point.column -= start.column;
970
+ point.row -= start.row;
971
+ };
972
+ 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);
973
+ exports.snippetManager = new SnippetManager();
974
+ var Editor = require("./editor").Editor;
975
+ (function () {
976
+ this.insertSnippet = function (content, options) {
977
+ return exports.snippetManager.insertSnippet(this, content, options);
978
+ };
979
+ this.expandSnippet = function (options) {
980
+ return exports.snippetManager.expandWithTab(this, options);
981
+ };
982
+ }).call(Editor.prototype);
983
+
984
+ });
985
+
986
+ ace.define("ace/ext/emmet",["require","exports","module","ace/keyboard/hash_handler","ace/editor","ace/snippets","ace/range","ace/config","resources","resources","tabStops","resources","utils","actions"], function(require, exports, module){/**
987
+ * ## Emmet extension
988
+ *
989
+ * Providing HTML/CSS abbreviation expansion, code navigation, and text editing utilities with configurable options and
990
+ * keyboard shortcuts for rapid web development workflow.
991
+ *
992
+ * **Enable:** `editor.setOption("enableEmmet", true)`
993
+ * or configure it during editor initialization in the options object.
994
+ * @module
995
+ */
996
+ "use strict";
997
+ var HashHandler = require("../keyboard/hash_handler").HashHandler;
998
+ var Editor = require("../editor").Editor;
999
+ var snippetManager = require("../snippets").snippetManager;
1000
+ var Range = require("../range").Range;
1001
+ var config = require("../config");
1002
+ var emmet, emmetPath;
1003
+ var AceEmmetEditor = /** @class */ (function () {
1004
+ function AceEmmetEditor() {
1005
+ }
1006
+ AceEmmetEditor.prototype.setupContext = function (editor) {
1007
+ this.ace = editor;
1008
+ this.indentation = editor.session.getTabString();
1009
+ if (!emmet)
1010
+ emmet = window["emmet"];
1011
+ var resources = emmet.resources || emmet.require("resources");
1012
+ resources.setVariable("indentation", this.indentation);
1013
+ this.$syntax = null;
1014
+ this.$syntax = this.getSyntax();
1015
+ };
1016
+ AceEmmetEditor.prototype.getSelectionRange = function () {
1017
+ var range = this.ace.getSelectionRange();
1018
+ var doc = this.ace.session.doc;
1019
+ return {
1020
+ start: doc.positionToIndex(range.start),
1021
+ end: doc.positionToIndex(range.end)
1022
+ };
1023
+ };
1024
+ AceEmmetEditor.prototype.createSelection = function (start, end) {
1025
+ var doc = this.ace.session.doc;
1026
+ this.ace.selection.setRange({
1027
+ start: doc.indexToPosition(start),
1028
+ end: doc.indexToPosition(end)
1029
+ });
1030
+ };
1031
+ AceEmmetEditor.prototype.getCurrentLineRange = function () {
1032
+ var ace = this.ace;
1033
+ var row = ace.getCursorPosition().row;
1034
+ var lineLength = ace.session.getLine(row).length;
1035
+ var index = ace.session.doc.positionToIndex({ row: row, column: 0 });
1036
+ return {
1037
+ start: index,
1038
+ end: index + lineLength
1039
+ };
1040
+ };
1041
+ AceEmmetEditor.prototype.getCaretPos = function () {
1042
+ var pos = this.ace.getCursorPosition();
1043
+ return this.ace.session.doc.positionToIndex(pos);
1044
+ };
1045
+ AceEmmetEditor.prototype.setCaretPos = function (index) {
1046
+ var pos = this.ace.session.doc.indexToPosition(index);
1047
+ this.ace.selection.moveToPosition(pos);
1048
+ };
1049
+ AceEmmetEditor.prototype.getCurrentLine = function () {
1050
+ var row = this.ace.getCursorPosition().row;
1051
+ return this.ace.session.getLine(row);
1052
+ };
1053
+ AceEmmetEditor.prototype.replaceContent = function (value, start, end, noIndent) {
1054
+ if (end == null)
1055
+ end = start == null ? this.getContent().length : start;
1056
+ if (start == null)
1057
+ start = 0;
1058
+ var editor = this.ace;
1059
+ var doc = editor.session.doc;
1060
+ var range = Range.fromPoints(doc.indexToPosition(start), doc.indexToPosition(end));
1061
+ editor.session.remove(range);
1062
+ range.end = range.start;
1063
+ value = this.$updateTabstops(value);
1064
+ snippetManager.insertSnippet(editor, value);
1065
+ };
1066
+ AceEmmetEditor.prototype.getContent = function () {
1067
+ return this.ace.getValue();
1068
+ };
1069
+ AceEmmetEditor.prototype.getSyntax = function () {
1070
+ if (this.$syntax)
1071
+ return this.$syntax;
1072
+ var syntax = this.ace.session.$modeId.split("/").pop();
1073
+ if (syntax == "html" || syntax == "php") {
1074
+ var cursor = this.ace.getCursorPosition();
1075
+ var state = this.ace.session.getState(cursor.row);
1076
+ if (typeof state != "string")
1077
+ state = state[0];
1078
+ if (state) {
1079
+ state = state.split("-");
1080
+ if (state.length > 1)
1081
+ syntax = state[0];
1082
+ else if (syntax == "php")
1083
+ syntax = "html";
1084
+ }
1085
+ }
1086
+ return syntax;
1087
+ };
1088
+ AceEmmetEditor.prototype.getProfileName = function () {
1089
+ var resources = emmet.resources || emmet.require("resources");
1090
+ switch (this.getSyntax()) {
1091
+ case "css": return "css";
1092
+ case "xml":
1093
+ case "xsl":
1094
+ return "xml";
1095
+ case "html":
1096
+ var profile = resources.getVariable("profile");
1097
+ if (!profile)
1098
+ profile = this.ace.session.getLines(0, 2).join("").search(/<!DOCTYPE[^>]+XHTML/i) != -1 ? "xhtml" : "html";
1099
+ return profile;
1100
+ default:
1101
+ var mode = this.ace.session.$mode;
1102
+ return mode.emmetConfig && mode.emmetConfig.profile || "xhtml";
1103
+ }
1104
+ };
1105
+ AceEmmetEditor.prototype.prompt = function (title) {
1106
+ return prompt(title); // eslint-disable-line no-alert
1107
+ };
1108
+ AceEmmetEditor.prototype.getSelection = function () {
1109
+ return this.ace.session.getTextRange();
1110
+ };
1111
+ AceEmmetEditor.prototype.getFilePath = function () {
1112
+ return "";
1113
+ };
1114
+ AceEmmetEditor.prototype.$updateTabstops = function (value) {
1115
+ var base = 1000;
1116
+ var zeroBase = 0;
1117
+ var lastZero = null;
1118
+ var ts = emmet.tabStops || emmet.require('tabStops');
1119
+ var resources = emmet.resources || emmet.require("resources");
1120
+ var settings = resources.getVocabulary("user");
1121
+ var tabstopOptions = {
1122
+ tabstop: function (data) {
1123
+ var group = parseInt(data.group, 10);
1124
+ var isZero = group === 0;
1125
+ if (isZero)
1126
+ group = ++zeroBase;
1127
+ else
1128
+ group += base;
1129
+ var placeholder = data.placeholder;
1130
+ if (placeholder) {
1131
+ placeholder = ts.processText(placeholder, tabstopOptions);
1132
+ }
1133
+ var result = '${' + group + (placeholder ? ':' + placeholder : '') + '}';
1134
+ if (isZero) {
1135
+ lastZero = [data.start, result];
1136
+ }
1137
+ return result;
1138
+ },
1139
+ escape: function (ch) {
1140
+ if (ch == '$')
1141
+ return '\\$';
1142
+ if (ch == '\\')
1143
+ return '\\\\';
1144
+ return ch;
1145
+ }
1146
+ };
1147
+ value = ts.processText(value, tabstopOptions);
1148
+ if (settings.variables['insert_final_tabstop'] && !/\$\{0\}$/.test(value)) {
1149
+ value += '${0}';
1150
+ }
1151
+ else if (lastZero) {
1152
+ var common = emmet.utils ? emmet.utils.common : emmet.require('utils');
1153
+ value = common.replaceSubstring(value, '${0}', lastZero[0], lastZero[1]);
1154
+ }
1155
+ return value;
1156
+ };
1157
+ return AceEmmetEditor;
1158
+ }());
1159
+ var keymap = {
1160
+ expand_abbreviation: { "mac": "ctrl+alt+e", "win": "alt+e" },
1161
+ match_pair_outward: { "mac": "ctrl+d", "win": "ctrl+," },
1162
+ match_pair_inward: { "mac": "ctrl+j", "win": "ctrl+shift+0" },
1163
+ matching_pair: { "mac": "ctrl+alt+j", "win": "alt+j" },
1164
+ next_edit_point: "alt+right",
1165
+ prev_edit_point: "alt+left",
1166
+ toggle_comment: { "mac": "command+/", "win": "ctrl+/" },
1167
+ split_join_tag: { "mac": "shift+command+'", "win": "shift+ctrl+`" },
1168
+ remove_tag: { "mac": "command+'", "win": "shift+ctrl+;" },
1169
+ evaluate_math_expression: { "mac": "shift+command+y", "win": "shift+ctrl+y" },
1170
+ increment_number_by_1: "ctrl+up",
1171
+ decrement_number_by_1: "ctrl+down",
1172
+ increment_number_by_01: "alt+up",
1173
+ decrement_number_by_01: "alt+down",
1174
+ increment_number_by_10: { "mac": "alt+command+up", "win": "shift+alt+up" },
1175
+ decrement_number_by_10: { "mac": "alt+command+down", "win": "shift+alt+down" },
1176
+ select_next_item: { "mac": "shift+command+.", "win": "shift+ctrl+." },
1177
+ select_previous_item: { "mac": "shift+command+,", "win": "shift+ctrl+," },
1178
+ reflect_css_value: { "mac": "shift+command+r", "win": "shift+ctrl+r" },
1179
+ encode_decode_data_url: { "mac": "shift+ctrl+d", "win": "ctrl+'" },
1180
+ expand_abbreviation_with_tab: "Tab",
1181
+ wrap_with_abbreviation: { "mac": "shift+ctrl+a", "win": "shift+ctrl+a" }
1182
+ };
1183
+ var editorProxy = new AceEmmetEditor();
1184
+ exports.commands = new HashHandler();
1185
+ exports.runEmmetCommand = function runEmmetCommand(editor) {
1186
+ if (this.action == "expand_abbreviation_with_tab") {
1187
+ if (!editor.selection.isEmpty())
1188
+ return false;
1189
+ var pos = editor.selection.lead;
1190
+ var token = editor.session.getTokenAt(pos.row, pos.column);
1191
+ if (token && /\btag\b/.test(token.type))
1192
+ return false;
1193
+ }
1194
+ try {
1195
+ editorProxy.setupContext(editor);
1196
+ var actions = emmet.actions || emmet.require("actions");
1197
+ if (this.action == "wrap_with_abbreviation") {
1198
+ return setTimeout(function () {
1199
+ actions.run("wrap_with_abbreviation", editorProxy);
1200
+ }, 0);
1201
+ }
1202
+ var result = actions.run(this.action, editorProxy);
1203
+ }
1204
+ catch (e) {
1205
+ if (!emmet) {
1206
+ var loading = exports.load(runEmmetCommand.bind(this, editor));
1207
+ if (this.action == "expand_abbreviation_with_tab")
1208
+ return false;
1209
+ return loading;
1210
+ }
1211
+ editor._signal("changeStatus", typeof e == "string" ? e : e.message);
1212
+ config.warn(e);
1213
+ result = false;
1214
+ }
1215
+ return result;
1216
+ };
1217
+ for (var command in keymap) {
1218
+ exports.commands.addCommand({
1219
+ name: "emmet:" + command,
1220
+ action: command,
1221
+ bindKey: keymap[command],
1222
+ exec: exports.runEmmetCommand,
1223
+ multiSelectAction: "forEach"
1224
+ });
1225
+ }
1226
+ exports.updateCommands = function (editor, enabled) {
1227
+ if (enabled) {
1228
+ editor.keyBinding.addKeyboardHandler(exports.commands);
1229
+ }
1230
+ else {
1231
+ editor.keyBinding.removeKeyboardHandler(exports.commands);
1232
+ }
1233
+ };
1234
+ exports.isSupportedMode = function (mode) {
1235
+ if (!mode)
1236
+ return false;
1237
+ if (mode.emmetConfig)
1238
+ return true;
1239
+ var id = mode.$id || mode;
1240
+ return /css|less|scss|sass|stylus|html|php|twig|ejs|handlebars/.test(id);
1241
+ };
1242
+ exports.isAvailable = function (editor, command) {
1243
+ if (/(evaluate_math_expression|expand_abbreviation)$/.test(command))
1244
+ return true;
1245
+ var mode = editor.session.$mode;
1246
+ var isSupported = exports.isSupportedMode(mode);
1247
+ if (isSupported && mode.$modes) {
1248
+ try {
1249
+ editorProxy.setupContext(editor);
1250
+ if (/js|php/.test(editorProxy.getSyntax()))
1251
+ isSupported = false;
1252
+ }
1253
+ catch (e) { }
1254
+ }
1255
+ return isSupported;
1256
+ };
1257
+ var onChangeMode = function (e, target) {
1258
+ var editor = target;
1259
+ if (!editor)
1260
+ return;
1261
+ var enabled = exports.isSupportedMode(editor.session.$mode);
1262
+ if (e.enableEmmet === false)
1263
+ enabled = false;
1264
+ if (enabled)
1265
+ exports.load();
1266
+ exports.updateCommands(editor, enabled);
1267
+ };
1268
+ exports.load = function (cb) {
1269
+ if (typeof emmetPath !== "string") {
1270
+ config.warn("script for emmet-core is not loaded");
1271
+ return false;
1272
+ }
1273
+ config.loadModule(emmetPath, function () {
1274
+ emmetPath = null;
1275
+ cb && cb();
1276
+ });
1277
+ return true;
1278
+ };
1279
+ exports.AceEmmetEditor = AceEmmetEditor;
1280
+ config.defineOptions(Editor.prototype, "editor", {
1281
+ enableEmmet: {
1282
+ set: function (val) {
1283
+ this[val ? "on" : "removeListener"]("changeMode", onChangeMode);
1284
+ onChangeMode({ enableEmmet: !!val }, this);
1285
+ },
1286
+ value: true
1287
+ }
1288
+ });
1289
+ exports.setCore = function (e) {
1290
+ if (typeof e == "string")
1291
+ emmetPath = e;
1292
+ else
1293
+ emmet = e;
1294
+ };
1295
+
1296
+ }); (function() {
1297
+ ace.require(["ace/ext/emmet"], function(m) {
1298
+ if (typeof module == "object" && typeof exports == "object" && module) {
1299
+ module.exports = m;
1300
+ }
1301
+ });
1302
+ })();
1303
+