ace-oqc 1.4.13

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 (401) hide show
  1. package/package.json +7 -0
  2. package/src-noconflict/ace.js +21402 -0
  3. package/src-noconflict/ext-beautify.js +331 -0
  4. package/src-noconflict/ext-elastic_tabstops_lite.js +277 -0
  5. package/src-noconflict/ext-emmet.js +1331 -0
  6. package/src-noconflict/ext-error_marker.js +9 -0
  7. package/src-noconflict/ext-keybinding_menu.js +193 -0
  8. package/src-noconflict/ext-language_tools.js +2166 -0
  9. package/src-noconflict/ext-linking.js +64 -0
  10. package/src-noconflict/ext-modelist.js +248 -0
  11. package/src-noconflict/ext-options.js +799 -0
  12. package/src-noconflict/ext-prompt.js +2806 -0
  13. package/src-noconflict/ext-rtl.js +122 -0
  14. package/src-noconflict/ext-searchbox.js +514 -0
  15. package/src-noconflict/ext-settings_menu.js +820 -0
  16. package/src-noconflict/ext-spellcheck.js +73 -0
  17. package/src-noconflict/ext-split.js +207 -0
  18. package/src-noconflict/ext-static_highlight.js +229 -0
  19. package/src-noconflict/ext-statusbar.js +56 -0
  20. package/src-noconflict/ext-textarea.js +430 -0
  21. package/src-noconflict/ext-themelist.js +67 -0
  22. package/src-noconflict/ext-whitespace.js +213 -0
  23. package/src-noconflict/keybinding-emacs.js +1169 -0
  24. package/src-noconflict/keybinding-sublime.js +422 -0
  25. package/src-noconflict/keybinding-vim.js +6198 -0
  26. package/src-noconflict/mode-abap.js +221 -0
  27. package/src-noconflict/mode-abc.js +271 -0
  28. package/src-noconflict/mode-actionscript.js +275 -0
  29. package/src-noconflict/mode-ada.js +137 -0
  30. package/src-noconflict/mode-apache_conf.js +363 -0
  31. package/src-noconflict/mode-apex.js +457 -0
  32. package/src-noconflict/mode-applescript.js +278 -0
  33. package/src-noconflict/mode-aql.js +102 -0
  34. package/src-noconflict/mode-asciidoc.js +349 -0
  35. package/src-noconflict/mode-asl.js +422 -0
  36. package/src-noconflict/mode-assembly_x86.js +193 -0
  37. package/src-noconflict/mode-autohotkey.js +244 -0
  38. package/src-noconflict/mode-batchfile.js +230 -0
  39. package/src-noconflict/mode-c9search.js +293 -0
  40. package/src-noconflict/mode-c_cpp.js +503 -0
  41. package/src-noconflict/mode-cirru.js +210 -0
  42. package/src-noconflict/mode-clojure.js +315 -0
  43. package/src-noconflict/mode-cobol.js +101 -0
  44. package/src-noconflict/mode-coffee.js +400 -0
  45. package/src-noconflict/mode-coldfusion.js +2596 -0
  46. package/src-noconflict/mode-crystal.js +642 -0
  47. package/src-noconflict/mode-csharp.js +502 -0
  48. package/src-noconflict/mode-csound_document.js +4105 -0
  49. package/src-noconflict/mode-csound_orchestra.js +3035 -0
  50. package/src-noconflict/mode-csound_score.js +462 -0
  51. package/src-noconflict/mode-csp.js +59 -0
  52. package/src-noconflict/mode-css.js +720 -0
  53. package/src-noconflict/mode-curly.js +2564 -0
  54. package/src-noconflict/mode-d.js +520 -0
  55. package/src-noconflict/mode-dart.js +715 -0
  56. package/src-noconflict/mode-diff.js +147 -0
  57. package/src-noconflict/mode-django.js +2595 -0
  58. package/src-noconflict/mode-dockerfile.js +500 -0
  59. package/src-noconflict/mode-dot.js +417 -0
  60. package/src-noconflict/mode-drools.js +498 -0
  61. package/src-noconflict/mode-edifact.js +166 -0
  62. package/src-noconflict/mode-eiffel.js +135 -0
  63. package/src-noconflict/mode-ejs.js +3533 -0
  64. package/src-noconflict/mode-elixir.js +501 -0
  65. package/src-noconflict/mode-elm.js +306 -0
  66. package/src-noconflict/mode-erlang.js +1010 -0
  67. package/src-noconflict/mode-forth.js +297 -0
  68. package/src-noconflict/mode-fortran.js +430 -0
  69. package/src-noconflict/mode-fsharp.js +316 -0
  70. package/src-noconflict/mode-fsl.js +259 -0
  71. package/src-noconflict/mode-ftl.js +1193 -0
  72. package/src-noconflict/mode-gcode.js +93 -0
  73. package/src-noconflict/mode-gherkin.js +168 -0
  74. package/src-noconflict/mode-gitignore.js +59 -0
  75. package/src-noconflict/mode-glsl.js +580 -0
  76. package/src-noconflict/mode-gobstones.js +1090 -0
  77. package/src-noconflict/mode-golang.js +413 -0
  78. package/src-noconflict/mode-graphqlschema.js +214 -0
  79. package/src-noconflict/mode-groovy.js +989 -0
  80. package/src-noconflict/mode-haml.js +1873 -0
  81. package/src-noconflict/mode-handlebars.js +2622 -0
  82. package/src-noconflict/mode-haskell.js +380 -0
  83. package/src-noconflict/mode-haskell_cabal.js +141 -0
  84. package/src-noconflict/mode-haxe.js +386 -0
  85. package/src-noconflict/mode-hjson.js +353 -0
  86. package/src-noconflict/mode-html.js +2509 -0
  87. package/src-noconflict/mode-html_elixir.js +3088 -0
  88. package/src-noconflict/mode-html_ruby.js +3550 -0
  89. package/src-noconflict/mode-ini.js +162 -0
  90. package/src-noconflict/mode-io.js +248 -0
  91. package/src-noconflict/mode-jack.js +346 -0
  92. package/src-noconflict/mode-jade.js +2025 -0
  93. package/src-noconflict/mode-java.js +1038 -0
  94. package/src-noconflict/mode-javascript.js +798 -0
  95. package/src-noconflict/mode-json.js +329 -0
  96. package/src-noconflict/mode-jsoniq.js +2632 -0
  97. package/src-noconflict/mode-jsp.js +1433 -0
  98. package/src-noconflict/mode-jssm.js +325 -0
  99. package/src-noconflict/mode-jsx.js +411 -0
  100. package/src-noconflict/mode-julia.js +303 -0
  101. package/src-noconflict/mode-kotlin.js +797 -0
  102. package/src-noconflict/mode-latex.js +296 -0
  103. package/src-noconflict/mode-less.js +839 -0
  104. package/src-noconflict/mode-liquid.js +2742 -0
  105. package/src-noconflict/mode-lisp.js +112 -0
  106. package/src-noconflict/mode-livescript.js +279 -0
  107. package/src-noconflict/mode-logiql.js +317 -0
  108. package/src-noconflict/mode-logtalk.js +352 -0
  109. package/src-noconflict/mode-lsl.js +343 -0
  110. package/src-noconflict/mode-lua.js +452 -0
  111. package/src-noconflict/mode-luapage.js +3028 -0
  112. package/src-noconflict/mode-lucene.js +154 -0
  113. package/src-noconflict/mode-makefile.js +412 -0
  114. package/src-noconflict/mode-markdown.js +3194 -0
  115. package/src-noconflict/mode-mask.js +1803 -0
  116. package/src-noconflict/mode-matlab.js +263 -0
  117. package/src-noconflict/mode-maze.js +292 -0
  118. package/src-noconflict/mode-mel.js +263 -0
  119. package/src-noconflict/mode-mixal.js +122 -0
  120. package/src-noconflict/mode-mushcode.js +681 -0
  121. package/src-noconflict/mode-mysql.js +167 -0
  122. package/src-noconflict/mode-nginx.js +298 -0
  123. package/src-noconflict/mode-nim.js +363 -0
  124. package/src-noconflict/mode-nix.js +647 -0
  125. package/src-noconflict/mode-nsis.js +312 -0
  126. package/src-noconflict/mode-objectivec.js +740 -0
  127. package/src-noconflict/mode-ocaml.js +421 -0
  128. package/src-noconflict/mode-pascal.js +223 -0
  129. package/src-noconflict/mode-perl.js +381 -0
  130. package/src-noconflict/mode-pgsql.js +1743 -0
  131. package/src-noconflict/mode-php.js +13110 -0
  132. package/src-noconflict/mode-php_laravel_blade.js +13311 -0
  133. package/src-noconflict/mode-pig.js +310 -0
  134. package/src-noconflict/mode-plain_text.js +32 -0
  135. package/src-noconflict/mode-powershell.js +418 -0
  136. package/src-noconflict/mode-praat.js +478 -0
  137. package/src-noconflict/mode-prolog.js +371 -0
  138. package/src-noconflict/mode-properties.js +80 -0
  139. package/src-noconflict/mode-protobuf.js +593 -0
  140. package/src-noconflict/mode-puppet.js +368 -0
  141. package/src-noconflict/mode-python.js +508 -0
  142. package/src-noconflict/mode-r.js +312 -0
  143. package/src-noconflict/mode-razor.js +2875 -0
  144. package/src-noconflict/mode-rdoc.js +243 -0
  145. package/src-noconflict/mode-red.js +450 -0
  146. package/src-noconflict/mode-redshift.js +360 -0
  147. package/src-noconflict/mode-rhtml.js +2808 -0
  148. package/src-noconflict/mode-rst.js +257 -0
  149. package/src-noconflict/mode-ruby.js +1003 -0
  150. package/src-noconflict/mode-rust.js +282 -0
  151. package/src-noconflict/mode-sass.js +529 -0
  152. package/src-noconflict/mode-scad.js +414 -0
  153. package/src-noconflict/mode-scala.js +984 -0
  154. package/src-noconflict/mode-scheme.js +232 -0
  155. package/src-noconflict/mode-scss.js +873 -0
  156. package/src-noconflict/mode-sh.js +449 -0
  157. package/src-noconflict/mode-sjs.js +1015 -0
  158. package/src-noconflict/mode-slim.js +5240 -0
  159. package/src-noconflict/mode-smarty.js +2635 -0
  160. package/src-noconflict/mode-snippets.js +207 -0
  161. package/src-noconflict/mode-soy_template.js +2848 -0
  162. package/src-noconflict/mode-space.js +167 -0
  163. package/src-noconflict/mode-sparql.js +320 -0
  164. package/src-noconflict/mode-sql.js +271 -0
  165. package/src-noconflict/mode-sqlserver.js +445 -0
  166. package/src-noconflict/mode-stylus.js +472 -0
  167. package/src-noconflict/mode-svg.js +1582 -0
  168. package/src-noconflict/mode-swift.js +395 -0
  169. package/src-noconflict/mode-tcl.js +387 -0
  170. package/src-noconflict/mode-terraform.js +400 -0
  171. package/src-noconflict/mode-tex.js +160 -0
  172. package/src-noconflict/mode-text.js +9 -0
  173. package/src-noconflict/mode-textile.js +150 -0
  174. package/src-noconflict/mode-toml.js +153 -0
  175. package/src-noconflict/mode-tsx.js +888 -0
  176. package/src-noconflict/mode-turtle.js +296 -0
  177. package/src-noconflict/mode-twig.js +2693 -0
  178. package/src-noconflict/mode-typescript.js +869 -0
  179. package/src-noconflict/mode-vala.js +677 -0
  180. package/src-noconflict/mode-vbscript.js +635 -0
  181. package/src-noconflict/mode-velocity.js +2792 -0
  182. package/src-noconflict/mode-verilog.js +118 -0
  183. package/src-noconflict/mode-vhdl.js +116 -0
  184. package/src-noconflict/mode-visualforce.js +2640 -0
  185. package/src-noconflict/mode-wollok.js +914 -0
  186. package/src-noconflict/mode-xml.js +676 -0
  187. package/src-noconflict/mode-xquery.js +2644 -0
  188. package/src-noconflict/mode-yaml.js +330 -0
  189. package/src-noconflict/mode-zeek.js +539 -0
  190. package/src-noconflict/qurator-mode.js +120 -0
  191. package/src-noconflict/qurator-worker.js +91 -0
  192. package/src-noconflict/snippets/abap.js +9 -0
  193. package/src-noconflict/snippets/abc.js +45 -0
  194. package/src-noconflict/snippets/actionscript.js +171 -0
  195. package/src-noconflict/snippets/ada.js +9 -0
  196. package/src-noconflict/snippets/apache_conf.js +9 -0
  197. package/src-noconflict/snippets/apex.js +9 -0
  198. package/src-noconflict/snippets/applescript.js +9 -0
  199. package/src-noconflict/snippets/aql.js +9 -0
  200. package/src-noconflict/snippets/asciidoc.js +9 -0
  201. package/src-noconflict/snippets/asl.js +9 -0
  202. package/src-noconflict/snippets/assembly_x86.js +9 -0
  203. package/src-noconflict/snippets/autohotkey.js +9 -0
  204. package/src-noconflict/snippets/batchfile.js +9 -0
  205. package/src-noconflict/snippets/c9search.js +9 -0
  206. package/src-noconflict/snippets/c_cpp.js +145 -0
  207. package/src-noconflict/snippets/cirru.js +9 -0
  208. package/src-noconflict/snippets/clojure.js +104 -0
  209. package/src-noconflict/snippets/cobol.js +9 -0
  210. package/src-noconflict/snippets/coffee.js +109 -0
  211. package/src-noconflict/snippets/coldfusion.js +9 -0
  212. package/src-noconflict/snippets/crystal.js +9 -0
  213. package/src-noconflict/snippets/csharp.js +9 -0
  214. package/src-noconflict/snippets/csound_document.js +24 -0
  215. package/src-noconflict/snippets/csound_orchestra.js +61 -0
  216. package/src-noconflict/snippets/csound_score.js +9 -0
  217. package/src-noconflict/snippets/csp.js +9 -0
  218. package/src-noconflict/snippets/css.js +981 -0
  219. package/src-noconflict/snippets/curly.js +9 -0
  220. package/src-noconflict/snippets/d.js +9 -0
  221. package/src-noconflict/snippets/dart.js +97 -0
  222. package/src-noconflict/snippets/diff.js +25 -0
  223. package/src-noconflict/snippets/django.js +122 -0
  224. package/src-noconflict/snippets/dockerfile.js +9 -0
  225. package/src-noconflict/snippets/dot.js +9 -0
  226. package/src-noconflict/snippets/drools.js +33 -0
  227. package/src-noconflict/snippets/edifact.js +254 -0
  228. package/src-noconflict/snippets/eiffel.js +9 -0
  229. package/src-noconflict/snippets/ejs.js +9 -0
  230. package/src-noconflict/snippets/elixir.js +9 -0
  231. package/src-noconflict/snippets/elm.js +9 -0
  232. package/src-noconflict/snippets/erlang.js +174 -0
  233. package/src-noconflict/snippets/forth.js +9 -0
  234. package/src-noconflict/snippets/fortran.js +9 -0
  235. package/src-noconflict/snippets/fsharp.js +9 -0
  236. package/src-noconflict/snippets/fsl.js +14 -0
  237. package/src-noconflict/snippets/ftl.js +9 -0
  238. package/src-noconflict/snippets/gcode.js +9 -0
  239. package/src-noconflict/snippets/gherkin.js +9 -0
  240. package/src-noconflict/snippets/gitignore.js +9 -0
  241. package/src-noconflict/snippets/glsl.js +9 -0
  242. package/src-noconflict/snippets/gobstones.js +1718 -0
  243. package/src-noconflict/snippets/golang.js +9 -0
  244. package/src-noconflict/snippets/graphqlschema.js +46 -0
  245. package/src-noconflict/snippets/groovy.js +9 -0
  246. package/src-noconflict/snippets/haml.js +34 -0
  247. package/src-noconflict/snippets/handlebars.js +9 -0
  248. package/src-noconflict/snippets/haskell.js +96 -0
  249. package/src-noconflict/snippets/haskell_cabal.js +9 -0
  250. package/src-noconflict/snippets/haxe.js +9 -0
  251. package/src-noconflict/snippets/hjson.js +9 -0
  252. package/src-noconflict/snippets/html.js +867 -0
  253. package/src-noconflict/snippets/html_elixir.js +9 -0
  254. package/src-noconflict/snippets/html_ruby.js +9 -0
  255. package/src-noconflict/snippets/ini.js +9 -0
  256. package/src-noconflict/snippets/io.js +76 -0
  257. package/src-noconflict/snippets/jack.js +9 -0
  258. package/src-noconflict/snippets/jade.js +9 -0
  259. package/src-noconflict/snippets/java.js +254 -0
  260. package/src-noconflict/snippets/javascript.js +209 -0
  261. package/src-noconflict/snippets/json.js +9 -0
  262. package/src-noconflict/snippets/jsoniq.js +75 -0
  263. package/src-noconflict/snippets/jsp.js +113 -0
  264. package/src-noconflict/snippets/jssm.js +9 -0
  265. package/src-noconflict/snippets/jsx.js +9 -0
  266. package/src-noconflict/snippets/julia.js +9 -0
  267. package/src-noconflict/snippets/kotlin.js +9 -0
  268. package/src-noconflict/snippets/latex.js +9 -0
  269. package/src-noconflict/snippets/less.js +9 -0
  270. package/src-noconflict/snippets/liquid.js +895 -0
  271. package/src-noconflict/snippets/lisp.js +9 -0
  272. package/src-noconflict/snippets/livescript.js +9 -0
  273. package/src-noconflict/snippets/logiql.js +9 -0
  274. package/src-noconflict/snippets/logtalk.js +9 -0
  275. package/src-noconflict/snippets/lsl.js +1246 -0
  276. package/src-noconflict/snippets/lua.js +35 -0
  277. package/src-noconflict/snippets/luapage.js +9 -0
  278. package/src-noconflict/snippets/lucene.js +9 -0
  279. package/src-noconflict/snippets/makefile.js +18 -0
  280. package/src-noconflict/snippets/markdown.js +102 -0
  281. package/src-noconflict/snippets/mask.js +9 -0
  282. package/src-noconflict/snippets/matlab.js +9 -0
  283. package/src-noconflict/snippets/maze.js +23 -0
  284. package/src-noconflict/snippets/mel.js +9 -0
  285. package/src-noconflict/snippets/mixal.js +9 -0
  286. package/src-noconflict/snippets/mushcode.js +9 -0
  287. package/src-noconflict/snippets/mysql.js +9 -0
  288. package/src-noconflict/snippets/nginx.js +9 -0
  289. package/src-noconflict/snippets/nim.js +9 -0
  290. package/src-noconflict/snippets/nix.js +9 -0
  291. package/src-noconflict/snippets/nsis.js +9 -0
  292. package/src-noconflict/snippets/objectivec.js +9 -0
  293. package/src-noconflict/snippets/ocaml.js +9 -0
  294. package/src-noconflict/snippets/pascal.js +9 -0
  295. package/src-noconflict/snippets/perl.js +361 -0
  296. package/src-noconflict/snippets/pgsql.js +9 -0
  297. package/src-noconflict/snippets/php.js +397 -0
  298. package/src-noconflict/snippets/php_laravel_blade.js +9 -0
  299. package/src-noconflict/snippets/pig.js +9 -0
  300. package/src-noconflict/snippets/plain_text.js +9 -0
  301. package/src-noconflict/snippets/powershell.js +9 -0
  302. package/src-noconflict/snippets/praat.js +9 -0
  303. package/src-noconflict/snippets/prolog.js +9 -0
  304. package/src-noconflict/snippets/properties.js +9 -0
  305. package/src-noconflict/snippets/protobuf.js +9 -0
  306. package/src-noconflict/snippets/puppet.js +9 -0
  307. package/src-noconflict/snippets/python.js +172 -0
  308. package/src-noconflict/snippets/r.js +135 -0
  309. package/src-noconflict/snippets/razor.js +17 -0
  310. package/src-noconflict/snippets/rdoc.js +9 -0
  311. package/src-noconflict/snippets/red.js +9 -0
  312. package/src-noconflict/snippets/redshift.js +9 -0
  313. package/src-noconflict/snippets/rhtml.js +9 -0
  314. package/src-noconflict/snippets/rst.js +36 -0
  315. package/src-noconflict/snippets/ruby.js +942 -0
  316. package/src-noconflict/snippets/rust.js +9 -0
  317. package/src-noconflict/snippets/sass.js +9 -0
  318. package/src-noconflict/snippets/scad.js +9 -0
  319. package/src-noconflict/snippets/scala.js +9 -0
  320. package/src-noconflict/snippets/scheme.js +9 -0
  321. package/src-noconflict/snippets/scss.js +9 -0
  322. package/src-noconflict/snippets/sh.js +97 -0
  323. package/src-noconflict/snippets/sjs.js +9 -0
  324. package/src-noconflict/snippets/slim.js +9 -0
  325. package/src-noconflict/snippets/smarty.js +9 -0
  326. package/src-noconflict/snippets/snippets.js +23 -0
  327. package/src-noconflict/snippets/soy_template.js +9 -0
  328. package/src-noconflict/snippets/space.js +9 -0
  329. package/src-noconflict/snippets/sparql.js +9 -0
  330. package/src-noconflict/snippets/sql.js +40 -0
  331. package/src-noconflict/snippets/sqlserver.js +83 -0
  332. package/src-noconflict/snippets/stylus.js +9 -0
  333. package/src-noconflict/snippets/svg.js +9 -0
  334. package/src-noconflict/snippets/swift.js +9 -0
  335. package/src-noconflict/snippets/tcl.js +106 -0
  336. package/src-noconflict/snippets/terraform.js +9 -0
  337. package/src-noconflict/snippets/tex.js +204 -0
  338. package/src-noconflict/snippets/text.js +9 -0
  339. package/src-noconflict/snippets/textile.js +44 -0
  340. package/src-noconflict/snippets/toml.js +9 -0
  341. package/src-noconflict/snippets/tsx.js +9 -0
  342. package/src-noconflict/snippets/turtle.js +9 -0
  343. package/src-noconflict/snippets/twig.js +9 -0
  344. package/src-noconflict/snippets/typescript.js +9 -0
  345. package/src-noconflict/snippets/vala.js +200 -0
  346. package/src-noconflict/snippets/vbscript.js +9 -0
  347. package/src-noconflict/snippets/velocity.js +43 -0
  348. package/src-noconflict/snippets/verilog.js +9 -0
  349. package/src-noconflict/snippets/vhdl.js +9 -0
  350. package/src-noconflict/snippets/visualforce.js +9 -0
  351. package/src-noconflict/snippets/wollok.js +98 -0
  352. package/src-noconflict/snippets/xml.js +9 -0
  353. package/src-noconflict/snippets/xquery.js +75 -0
  354. package/src-noconflict/snippets/yaml.js +9 -0
  355. package/src-noconflict/snippets/zeek.js +9 -0
  356. package/src-noconflict/theme-ambiance.js +185 -0
  357. package/src-noconflict/theme-chaos.js +163 -0
  358. package/src-noconflict/theme-chrome.js +135 -0
  359. package/src-noconflict/theme-clouds.js +102 -0
  360. package/src-noconflict/theme-clouds_midnight.js +103 -0
  361. package/src-noconflict/theme-cobalt.js +120 -0
  362. package/src-noconflict/theme-crimson_editor.js +125 -0
  363. package/src-noconflict/theme-dawn.js +115 -0
  364. package/src-noconflict/theme-dracula.js +135 -0
  365. package/src-noconflict/theme-dreamweaver.js +148 -0
  366. package/src-noconflict/theme-eclipse.js +105 -0
  367. package/src-noconflict/theme-github.js +110 -0
  368. package/src-noconflict/theme-gob.js +119 -0
  369. package/src-noconflict/theme-gruvbox.js +89 -0
  370. package/src-noconflict/theme-idle_fingers.js +103 -0
  371. package/src-noconflict/theme-iplastic.js +128 -0
  372. package/src-noconflict/theme-katzenmilch.js +128 -0
  373. package/src-noconflict/theme-kr_theme.js +111 -0
  374. package/src-noconflict/theme-kuroir.js +68 -0
  375. package/src-noconflict/theme-merbivore.js +102 -0
  376. package/src-noconflict/theme-merbivore_soft.js +103 -0
  377. package/src-noconflict/theme-mono_industrial.js +114 -0
  378. package/src-noconflict/theme-monokai.js +112 -0
  379. package/src-noconflict/theme-pastel_on_dark.js +115 -0
  380. package/src-noconflict/theme-solarized_dark.js +95 -0
  381. package/src-noconflict/theme-solarized_light.js +98 -0
  382. package/src-noconflict/theme-sqlserver.js +145 -0
  383. package/src-noconflict/theme-terminal.js +121 -0
  384. package/src-noconflict/theme-textmate.js +137 -0
  385. package/src-noconflict/theme-tomorrow.js +115 -0
  386. package/src-noconflict/theme-tomorrow_night.js +115 -0
  387. package/src-noconflict/theme-tomorrow_night_blue.js +113 -0
  388. package/src-noconflict/theme-tomorrow_night_bright.js +128 -0
  389. package/src-noconflict/theme-tomorrow_night_eighties.js +115 -0
  390. package/src-noconflict/theme-twilight.js +116 -0
  391. package/src-noconflict/theme-vibrant_ink.js +101 -0
  392. package/src-noconflict/theme-xcode.js +95 -0
  393. package/src-noconflict/worker-coffee.js +1470 -0
  394. package/src-noconflict/worker-css.js +9000 -0
  395. package/src-noconflict/worker-html.js +10922 -0
  396. package/src-noconflict/worker-javascript.js +15001 -0
  397. package/src-noconflict/worker-json.js +1715 -0
  398. package/src-noconflict/worker-lua.js +3608 -0
  399. package/src-noconflict/worker-php.js +3687 -0
  400. package/src-noconflict/worker-xml.js +3208 -0
  401. package/src-noconflict/worker-xquery.js +57668 -0
@@ -0,0 +1,3208 @@
1
+ "no use strict";
2
+ !(function(window) {
3
+ if (typeof window.window != "undefined" && window.document)
4
+ return;
5
+ if (window.require && window.define)
6
+ return;
7
+
8
+ if (!window.console) {
9
+ window.console = function() {
10
+ var msgs = Array.prototype.slice.call(arguments, 0);
11
+ postMessage({type: "log", data: msgs});
12
+ };
13
+ window.console.error =
14
+ window.console.warn =
15
+ window.console.log =
16
+ window.console.trace = window.console;
17
+ }
18
+ window.window = window;
19
+ window.ace = window;
20
+
21
+ window.onerror = function(message, file, line, col, err) {
22
+ postMessage({type: "error", data: {
23
+ message: message,
24
+ data: err.data,
25
+ file: file,
26
+ line: line,
27
+ col: col,
28
+ stack: err.stack
29
+ }});
30
+ };
31
+
32
+ window.normalizeModule = function(parentId, moduleName) {
33
+ // normalize plugin requires
34
+ if (moduleName.indexOf("!") !== -1) {
35
+ var chunks = moduleName.split("!");
36
+ return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]);
37
+ }
38
+ // normalize relative requires
39
+ if (moduleName.charAt(0) == ".") {
40
+ var base = parentId.split("/").slice(0, -1).join("/");
41
+ moduleName = (base ? base + "/" : "") + moduleName;
42
+
43
+ while (moduleName.indexOf(".") !== -1 && previous != moduleName) {
44
+ var previous = moduleName;
45
+ moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
46
+ }
47
+ }
48
+
49
+ return moduleName;
50
+ };
51
+
52
+ window.require = function require(parentId, id) {
53
+ if (!id) {
54
+ id = parentId;
55
+ parentId = null;
56
+ }
57
+ if (!id.charAt)
58
+ throw new Error("worker.js require() accepts only (parentId, id) as arguments");
59
+
60
+ id = window.normalizeModule(parentId, id);
61
+
62
+ var module = window.require.modules[id];
63
+ if (module) {
64
+ if (!module.initialized) {
65
+ module.initialized = true;
66
+ module.exports = module.factory().exports;
67
+ }
68
+ return module.exports;
69
+ }
70
+
71
+ if (!window.require.tlns)
72
+ return console.log("unable to load " + id);
73
+
74
+ var path = resolveModuleId(id, window.require.tlns);
75
+ if (path.slice(-3) != ".js") path += ".js";
76
+
77
+ window.require.id = id;
78
+ window.require.modules[id] = {}; // prevent infinite loop on broken modules
79
+ importScripts(path);
80
+ return window.require(parentId, id);
81
+ };
82
+ function resolveModuleId(id, paths) {
83
+ var testPath = id, tail = "";
84
+ while (testPath) {
85
+ var alias = paths[testPath];
86
+ if (typeof alias == "string") {
87
+ return alias + tail;
88
+ } else if (alias) {
89
+ return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name);
90
+ } else if (alias === false) {
91
+ return "";
92
+ }
93
+ var i = testPath.lastIndexOf("/");
94
+ if (i === -1) break;
95
+ tail = testPath.substr(i) + tail;
96
+ testPath = testPath.slice(0, i);
97
+ }
98
+ return id;
99
+ }
100
+ window.require.modules = {};
101
+ window.require.tlns = {};
102
+
103
+ window.define = function(id, deps, factory) {
104
+ if (arguments.length == 2) {
105
+ factory = deps;
106
+ if (typeof id != "string") {
107
+ deps = id;
108
+ id = window.require.id;
109
+ }
110
+ } else if (arguments.length == 1) {
111
+ factory = id;
112
+ deps = [];
113
+ id = window.require.id;
114
+ }
115
+
116
+ if (typeof factory != "function") {
117
+ window.require.modules[id] = {
118
+ exports: factory,
119
+ initialized: true
120
+ };
121
+ return;
122
+ }
123
+
124
+ if (!deps.length)
125
+ // If there is no dependencies, we inject "require", "exports" and
126
+ // "module" as dependencies, to provide CommonJS compatibility.
127
+ deps = ["require", "exports", "module"];
128
+
129
+ var req = function(childId) {
130
+ return window.require(id, childId);
131
+ };
132
+
133
+ window.require.modules[id] = {
134
+ exports: {},
135
+ factory: function() {
136
+ var module = this;
137
+ var returnExports = factory.apply(this, deps.slice(0, factory.length).map(function(dep) {
138
+ switch (dep) {
139
+ // Because "require", "exports" and "module" aren't actual
140
+ // dependencies, we must handle them seperately.
141
+ case "require": return req;
142
+ case "exports": return module.exports;
143
+ case "module": return module;
144
+ // But for all other dependencies, we can just go ahead and
145
+ // require them.
146
+ default: return req(dep);
147
+ }
148
+ }));
149
+ if (returnExports)
150
+ module.exports = returnExports;
151
+ return module;
152
+ }
153
+ };
154
+ };
155
+ window.define.amd = {};
156
+ require.tlns = {};
157
+ window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
158
+ for (var i in topLevelNamespaces)
159
+ require.tlns[i] = topLevelNamespaces[i];
160
+ };
161
+
162
+ window.initSender = function initSender() {
163
+
164
+ var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter;
165
+ var oop = window.require("ace/lib/oop");
166
+
167
+ var Sender = function() {};
168
+
169
+ (function() {
170
+
171
+ oop.implement(this, EventEmitter);
172
+
173
+ this.callback = function(data, callbackId) {
174
+ postMessage({
175
+ type: "call",
176
+ id: callbackId,
177
+ data: data
178
+ });
179
+ };
180
+
181
+ this.emit = function(name, data) {
182
+ postMessage({
183
+ type: "event",
184
+ name: name,
185
+ data: data
186
+ });
187
+ };
188
+
189
+ }).call(Sender.prototype);
190
+
191
+ return new Sender();
192
+ };
193
+
194
+ var main = window.main = null;
195
+ var sender = window.sender = null;
196
+
197
+ window.onmessage = function(e) {
198
+ var msg = e.data;
199
+ if (msg.event && sender) {
200
+ sender._signal(msg.event, msg.data);
201
+ }
202
+ else if (msg.command) {
203
+ if (main[msg.command])
204
+ main[msg.command].apply(main, msg.args);
205
+ else if (window[msg.command])
206
+ window[msg.command].apply(window, msg.args);
207
+ else
208
+ throw new Error("Unknown command:" + msg.command);
209
+ }
210
+ else if (msg.init) {
211
+ window.initBaseUrls(msg.tlns);
212
+ sender = window.sender = window.initSender();
213
+ var clazz = require(msg.module)[msg.classname];
214
+ main = window.main = new clazz(sender);
215
+ }
216
+ };
217
+ })(this);
218
+
219
+ ace.define("ace/lib/oop",[], function(require, exports, module) {
220
+ "use strict";
221
+
222
+ exports.inherits = function(ctor, superCtor) {
223
+ ctor.super_ = superCtor;
224
+ ctor.prototype = Object.create(superCtor.prototype, {
225
+ constructor: {
226
+ value: ctor,
227
+ enumerable: false,
228
+ writable: true,
229
+ configurable: true
230
+ }
231
+ });
232
+ };
233
+
234
+ exports.mixin = function(obj, mixin) {
235
+ for (var key in mixin) {
236
+ obj[key] = mixin[key];
237
+ }
238
+ return obj;
239
+ };
240
+
241
+ exports.implement = function(proto, mixin) {
242
+ exports.mixin(proto, mixin);
243
+ };
244
+
245
+ });
246
+
247
+ ace.define("ace/lib/lang",[], function(require, exports, module) {
248
+ "use strict";
249
+
250
+ exports.last = function(a) {
251
+ return a[a.length - 1];
252
+ };
253
+
254
+ exports.stringReverse = function(string) {
255
+ return string.split("").reverse().join("");
256
+ };
257
+
258
+ exports.stringRepeat = function (string, count) {
259
+ var result = '';
260
+ while (count > 0) {
261
+ if (count & 1)
262
+ result += string;
263
+
264
+ if (count >>= 1)
265
+ string += string;
266
+ }
267
+ return result;
268
+ };
269
+
270
+ var trimBeginRegexp = /^\s\s*/;
271
+ var trimEndRegexp = /\s\s*$/;
272
+
273
+ exports.stringTrimLeft = function (string) {
274
+ return string.replace(trimBeginRegexp, '');
275
+ };
276
+
277
+ exports.stringTrimRight = function (string) {
278
+ return string.replace(trimEndRegexp, '');
279
+ };
280
+
281
+ exports.copyObject = function(obj) {
282
+ var copy = {};
283
+ for (var key in obj) {
284
+ copy[key] = obj[key];
285
+ }
286
+ return copy;
287
+ };
288
+
289
+ exports.copyArray = function(array){
290
+ var copy = [];
291
+ for (var i=0, l=array.length; i<l; i++) {
292
+ if (array[i] && typeof array[i] == "object")
293
+ copy[i] = this.copyObject(array[i]);
294
+ else
295
+ copy[i] = array[i];
296
+ }
297
+ return copy;
298
+ };
299
+
300
+ exports.deepCopy = function deepCopy(obj) {
301
+ if (typeof obj !== "object" || !obj)
302
+ return obj;
303
+ var copy;
304
+ if (Array.isArray(obj)) {
305
+ copy = [];
306
+ for (var key = 0; key < obj.length; key++) {
307
+ copy[key] = deepCopy(obj[key]);
308
+ }
309
+ return copy;
310
+ }
311
+ if (Object.prototype.toString.call(obj) !== "[object Object]")
312
+ return obj;
313
+
314
+ copy = {};
315
+ for (var key in obj)
316
+ copy[key] = deepCopy(obj[key]);
317
+ return copy;
318
+ };
319
+
320
+ exports.arrayToMap = function(arr) {
321
+ var map = {};
322
+ for (var i=0; i<arr.length; i++) {
323
+ map[arr[i]] = 1;
324
+ }
325
+ return map;
326
+
327
+ };
328
+
329
+ exports.createMap = function(props) {
330
+ var map = Object.create(null);
331
+ for (var i in props) {
332
+ map[i] = props[i];
333
+ }
334
+ return map;
335
+ };
336
+ exports.arrayRemove = function(array, value) {
337
+ for (var i = 0; i <= array.length; i++) {
338
+ if (value === array[i]) {
339
+ array.splice(i, 1);
340
+ }
341
+ }
342
+ };
343
+
344
+ exports.escapeRegExp = function(str) {
345
+ return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
346
+ };
347
+
348
+ exports.escapeHTML = function(str) {
349
+ return ("" + str).replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
350
+ };
351
+
352
+ exports.getMatchOffsets = function(string, regExp) {
353
+ var matches = [];
354
+
355
+ string.replace(regExp, function(str) {
356
+ matches.push({
357
+ offset: arguments[arguments.length-2],
358
+ length: str.length
359
+ });
360
+ });
361
+
362
+ return matches;
363
+ };
364
+ exports.deferredCall = function(fcn) {
365
+ var timer = null;
366
+ var callback = function() {
367
+ timer = null;
368
+ fcn();
369
+ };
370
+
371
+ var deferred = function(timeout) {
372
+ deferred.cancel();
373
+ timer = setTimeout(callback, timeout || 0);
374
+ return deferred;
375
+ };
376
+
377
+ deferred.schedule = deferred;
378
+
379
+ deferred.call = function() {
380
+ this.cancel();
381
+ fcn();
382
+ return deferred;
383
+ };
384
+
385
+ deferred.cancel = function() {
386
+ clearTimeout(timer);
387
+ timer = null;
388
+ return deferred;
389
+ };
390
+
391
+ deferred.isPending = function() {
392
+ return timer;
393
+ };
394
+
395
+ return deferred;
396
+ };
397
+
398
+
399
+ exports.delayedCall = function(fcn, defaultTimeout) {
400
+ var timer = null;
401
+ var callback = function() {
402
+ timer = null;
403
+ fcn();
404
+ };
405
+
406
+ var _self = function(timeout) {
407
+ if (timer == null)
408
+ timer = setTimeout(callback, timeout || defaultTimeout);
409
+ };
410
+
411
+ _self.delay = function(timeout) {
412
+ timer && clearTimeout(timer);
413
+ timer = setTimeout(callback, timeout || defaultTimeout);
414
+ };
415
+ _self.schedule = _self;
416
+
417
+ _self.call = function() {
418
+ this.cancel();
419
+ fcn();
420
+ };
421
+
422
+ _self.cancel = function() {
423
+ timer && clearTimeout(timer);
424
+ timer = null;
425
+ };
426
+
427
+ _self.isPending = function() {
428
+ return timer;
429
+ };
430
+
431
+ return _self;
432
+ };
433
+ });
434
+
435
+ ace.define("ace/range",[], function(require, exports, module) {
436
+ "use strict";
437
+ var comparePoints = function(p1, p2) {
438
+ return p1.row - p2.row || p1.column - p2.column;
439
+ };
440
+ var Range = function(startRow, startColumn, endRow, endColumn) {
441
+ this.start = {
442
+ row: startRow,
443
+ column: startColumn
444
+ };
445
+
446
+ this.end = {
447
+ row: endRow,
448
+ column: endColumn
449
+ };
450
+ };
451
+
452
+ (function() {
453
+ this.isEqual = function(range) {
454
+ return this.start.row === range.start.row &&
455
+ this.end.row === range.end.row &&
456
+ this.start.column === range.start.column &&
457
+ this.end.column === range.end.column;
458
+ };
459
+ this.toString = function() {
460
+ return ("Range: [" + this.start.row + "/" + this.start.column +
461
+ "] -> [" + this.end.row + "/" + this.end.column + "]");
462
+ };
463
+
464
+ this.contains = function(row, column) {
465
+ return this.compare(row, column) == 0;
466
+ };
467
+ this.compareRange = function(range) {
468
+ var cmp,
469
+ end = range.end,
470
+ start = range.start;
471
+
472
+ cmp = this.compare(end.row, end.column);
473
+ if (cmp == 1) {
474
+ cmp = this.compare(start.row, start.column);
475
+ if (cmp == 1) {
476
+ return 2;
477
+ } else if (cmp == 0) {
478
+ return 1;
479
+ } else {
480
+ return 0;
481
+ }
482
+ } else if (cmp == -1) {
483
+ return -2;
484
+ } else {
485
+ cmp = this.compare(start.row, start.column);
486
+ if (cmp == -1) {
487
+ return -1;
488
+ } else if (cmp == 1) {
489
+ return 42;
490
+ } else {
491
+ return 0;
492
+ }
493
+ }
494
+ };
495
+ this.comparePoint = function(p) {
496
+ return this.compare(p.row, p.column);
497
+ };
498
+ this.containsRange = function(range) {
499
+ return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
500
+ };
501
+ this.intersects = function(range) {
502
+ var cmp = this.compareRange(range);
503
+ return (cmp == -1 || cmp == 0 || cmp == 1);
504
+ };
505
+ this.isEnd = function(row, column) {
506
+ return this.end.row == row && this.end.column == column;
507
+ };
508
+ this.isStart = function(row, column) {
509
+ return this.start.row == row && this.start.column == column;
510
+ };
511
+ this.setStart = function(row, column) {
512
+ if (typeof row == "object") {
513
+ this.start.column = row.column;
514
+ this.start.row = row.row;
515
+ } else {
516
+ this.start.row = row;
517
+ this.start.column = column;
518
+ }
519
+ };
520
+ this.setEnd = function(row, column) {
521
+ if (typeof row == "object") {
522
+ this.end.column = row.column;
523
+ this.end.row = row.row;
524
+ } else {
525
+ this.end.row = row;
526
+ this.end.column = column;
527
+ }
528
+ };
529
+ this.inside = function(row, column) {
530
+ if (this.compare(row, column) == 0) {
531
+ if (this.isEnd(row, column) || this.isStart(row, column)) {
532
+ return false;
533
+ } else {
534
+ return true;
535
+ }
536
+ }
537
+ return false;
538
+ };
539
+ this.insideStart = function(row, column) {
540
+ if (this.compare(row, column) == 0) {
541
+ if (this.isEnd(row, column)) {
542
+ return false;
543
+ } else {
544
+ return true;
545
+ }
546
+ }
547
+ return false;
548
+ };
549
+ this.insideEnd = function(row, column) {
550
+ if (this.compare(row, column) == 0) {
551
+ if (this.isStart(row, column)) {
552
+ return false;
553
+ } else {
554
+ return true;
555
+ }
556
+ }
557
+ return false;
558
+ };
559
+ this.compare = function(row, column) {
560
+ if (!this.isMultiLine()) {
561
+ if (row === this.start.row) {
562
+ return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
563
+ }
564
+ }
565
+
566
+ if (row < this.start.row)
567
+ return -1;
568
+
569
+ if (row > this.end.row)
570
+ return 1;
571
+
572
+ if (this.start.row === row)
573
+ return column >= this.start.column ? 0 : -1;
574
+
575
+ if (this.end.row === row)
576
+ return column <= this.end.column ? 0 : 1;
577
+
578
+ return 0;
579
+ };
580
+ this.compareStart = function(row, column) {
581
+ if (this.start.row == row && this.start.column == column) {
582
+ return -1;
583
+ } else {
584
+ return this.compare(row, column);
585
+ }
586
+ };
587
+ this.compareEnd = function(row, column) {
588
+ if (this.end.row == row && this.end.column == column) {
589
+ return 1;
590
+ } else {
591
+ return this.compare(row, column);
592
+ }
593
+ };
594
+ this.compareInside = function(row, column) {
595
+ if (this.end.row == row && this.end.column == column) {
596
+ return 1;
597
+ } else if (this.start.row == row && this.start.column == column) {
598
+ return -1;
599
+ } else {
600
+ return this.compare(row, column);
601
+ }
602
+ };
603
+ this.clipRows = function(firstRow, lastRow) {
604
+ if (this.end.row > lastRow)
605
+ var end = {row: lastRow + 1, column: 0};
606
+ else if (this.end.row < firstRow)
607
+ var end = {row: firstRow, column: 0};
608
+
609
+ if (this.start.row > lastRow)
610
+ var start = {row: lastRow + 1, column: 0};
611
+ else if (this.start.row < firstRow)
612
+ var start = {row: firstRow, column: 0};
613
+
614
+ return Range.fromPoints(start || this.start, end || this.end);
615
+ };
616
+ this.extend = function(row, column) {
617
+ var cmp = this.compare(row, column);
618
+
619
+ if (cmp == 0)
620
+ return this;
621
+ else if (cmp == -1)
622
+ var start = {row: row, column: column};
623
+ else
624
+ var end = {row: row, column: column};
625
+
626
+ return Range.fromPoints(start || this.start, end || this.end);
627
+ };
628
+
629
+ this.isEmpty = function() {
630
+ return (this.start.row === this.end.row && this.start.column === this.end.column);
631
+ };
632
+ this.isMultiLine = function() {
633
+ return (this.start.row !== this.end.row);
634
+ };
635
+ this.clone = function() {
636
+ return Range.fromPoints(this.start, this.end);
637
+ };
638
+ this.collapseRows = function() {
639
+ if (this.end.column == 0)
640
+ return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0);
641
+ else
642
+ return new Range(this.start.row, 0, this.end.row, 0);
643
+ };
644
+ this.toScreenRange = function(session) {
645
+ var screenPosStart = session.documentToScreenPosition(this.start);
646
+ var screenPosEnd = session.documentToScreenPosition(this.end);
647
+
648
+ return new Range(
649
+ screenPosStart.row, screenPosStart.column,
650
+ screenPosEnd.row, screenPosEnd.column
651
+ );
652
+ };
653
+ this.moveBy = function(row, column) {
654
+ this.start.row += row;
655
+ this.start.column += column;
656
+ this.end.row += row;
657
+ this.end.column += column;
658
+ };
659
+
660
+ }).call(Range.prototype);
661
+ Range.fromPoints = function(start, end) {
662
+ return new Range(start.row, start.column, end.row, end.column);
663
+ };
664
+ Range.comparePoints = comparePoints;
665
+
666
+ Range.comparePoints = function(p1, p2) {
667
+ return p1.row - p2.row || p1.column - p2.column;
668
+ };
669
+
670
+
671
+ exports.Range = Range;
672
+ });
673
+
674
+ ace.define("ace/apply_delta",[], function(require, exports, module) {
675
+ "use strict";
676
+
677
+ function throwDeltaError(delta, errorText){
678
+ console.log("Invalid Delta:", delta);
679
+ throw "Invalid Delta: " + errorText;
680
+ }
681
+
682
+ function positionInDocument(docLines, position) {
683
+ return position.row >= 0 && position.row < docLines.length &&
684
+ position.column >= 0 && position.column <= docLines[position.row].length;
685
+ }
686
+
687
+ function validateDelta(docLines, delta) {
688
+ if (delta.action != "insert" && delta.action != "remove")
689
+ throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
690
+ if (!(delta.lines instanceof Array))
691
+ throwDeltaError(delta, "delta.lines must be an Array");
692
+ if (!delta.start || !delta.end)
693
+ throwDeltaError(delta, "delta.start/end must be an present");
694
+ var start = delta.start;
695
+ if (!positionInDocument(docLines, delta.start))
696
+ throwDeltaError(delta, "delta.start must be contained in document");
697
+ var end = delta.end;
698
+ if (delta.action == "remove" && !positionInDocument(docLines, end))
699
+ throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
700
+ var numRangeRows = end.row - start.row;
701
+ var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
702
+ if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
703
+ throwDeltaError(delta, "delta.range must match delta lines");
704
+ }
705
+
706
+ exports.applyDelta = function(docLines, delta, doNotValidate) {
707
+
708
+ var row = delta.start.row;
709
+ var startColumn = delta.start.column;
710
+ var line = docLines[row] || "";
711
+ switch (delta.action) {
712
+ case "insert":
713
+ var lines = delta.lines;
714
+ if (lines.length === 1) {
715
+ docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
716
+ } else {
717
+ var args = [row, 1].concat(delta.lines);
718
+ docLines.splice.apply(docLines, args);
719
+ docLines[row] = line.substring(0, startColumn) + docLines[row];
720
+ docLines[row + delta.lines.length - 1] += line.substring(startColumn);
721
+ }
722
+ break;
723
+ case "remove":
724
+ var endColumn = delta.end.column;
725
+ var endRow = delta.end.row;
726
+ if (row === endRow) {
727
+ docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
728
+ } else {
729
+ docLines.splice(
730
+ row, endRow - row + 1,
731
+ line.substring(0, startColumn) + docLines[endRow].substring(endColumn)
732
+ );
733
+ }
734
+ break;
735
+ }
736
+ };
737
+ });
738
+
739
+ ace.define("ace/lib/event_emitter",[], function(require, exports, module) {
740
+ "use strict";
741
+
742
+ var EventEmitter = {};
743
+ var stopPropagation = function() { this.propagationStopped = true; };
744
+ var preventDefault = function() { this.defaultPrevented = true; };
745
+
746
+ EventEmitter._emit =
747
+ EventEmitter._dispatchEvent = function(eventName, e) {
748
+ this._eventRegistry || (this._eventRegistry = {});
749
+ this._defaultHandlers || (this._defaultHandlers = {});
750
+
751
+ var listeners = this._eventRegistry[eventName] || [];
752
+ var defaultHandler = this._defaultHandlers[eventName];
753
+ if (!listeners.length && !defaultHandler)
754
+ return;
755
+
756
+ if (typeof e != "object" || !e)
757
+ e = {};
758
+
759
+ if (!e.type)
760
+ e.type = eventName;
761
+ if (!e.stopPropagation)
762
+ e.stopPropagation = stopPropagation;
763
+ if (!e.preventDefault)
764
+ e.preventDefault = preventDefault;
765
+
766
+ listeners = listeners.slice();
767
+ for (var i=0; i<listeners.length; i++) {
768
+ listeners[i](e, this);
769
+ if (e.propagationStopped)
770
+ break;
771
+ }
772
+
773
+ if (defaultHandler && !e.defaultPrevented)
774
+ return defaultHandler(e, this);
775
+ };
776
+
777
+
778
+ EventEmitter._signal = function(eventName, e) {
779
+ var listeners = (this._eventRegistry || {})[eventName];
780
+ if (!listeners)
781
+ return;
782
+ listeners = listeners.slice();
783
+ for (var i=0; i<listeners.length; i++)
784
+ listeners[i](e, this);
785
+ };
786
+
787
+ EventEmitter.once = function(eventName, callback) {
788
+ var _self = this;
789
+ this.on(eventName, function newCallback() {
790
+ _self.off(eventName, newCallback);
791
+ callback.apply(null, arguments);
792
+ });
793
+ if (!callback) {
794
+ return new Promise(function(resolve) {
795
+ callback = resolve;
796
+ });
797
+ }
798
+ };
799
+
800
+
801
+ EventEmitter.setDefaultHandler = function(eventName, callback) {
802
+ var handlers = this._defaultHandlers;
803
+ if (!handlers)
804
+ handlers = this._defaultHandlers = {_disabled_: {}};
805
+
806
+ if (handlers[eventName]) {
807
+ var old = handlers[eventName];
808
+ var disabled = handlers._disabled_[eventName];
809
+ if (!disabled)
810
+ handlers._disabled_[eventName] = disabled = [];
811
+ disabled.push(old);
812
+ var i = disabled.indexOf(callback);
813
+ if (i != -1)
814
+ disabled.splice(i, 1);
815
+ }
816
+ handlers[eventName] = callback;
817
+ };
818
+ EventEmitter.removeDefaultHandler = function(eventName, callback) {
819
+ var handlers = this._defaultHandlers;
820
+ if (!handlers)
821
+ return;
822
+ var disabled = handlers._disabled_[eventName];
823
+
824
+ if (handlers[eventName] == callback) {
825
+ if (disabled)
826
+ this.setDefaultHandler(eventName, disabled.pop());
827
+ } else if (disabled) {
828
+ var i = disabled.indexOf(callback);
829
+ if (i != -1)
830
+ disabled.splice(i, 1);
831
+ }
832
+ };
833
+
834
+ EventEmitter.on =
835
+ EventEmitter.addEventListener = function(eventName, callback, capturing) {
836
+ this._eventRegistry = this._eventRegistry || {};
837
+
838
+ var listeners = this._eventRegistry[eventName];
839
+ if (!listeners)
840
+ listeners = this._eventRegistry[eventName] = [];
841
+
842
+ if (listeners.indexOf(callback) == -1)
843
+ listeners[capturing ? "unshift" : "push"](callback);
844
+ return callback;
845
+ };
846
+
847
+ EventEmitter.off =
848
+ EventEmitter.removeListener =
849
+ EventEmitter.removeEventListener = function(eventName, callback) {
850
+ this._eventRegistry = this._eventRegistry || {};
851
+
852
+ var listeners = this._eventRegistry[eventName];
853
+ if (!listeners)
854
+ return;
855
+
856
+ var index = listeners.indexOf(callback);
857
+ if (index !== -1)
858
+ listeners.splice(index, 1);
859
+ };
860
+
861
+ EventEmitter.removeAllListeners = function(eventName) {
862
+ if (!eventName) this._eventRegistry = this._defaultHandlers = undefined;
863
+ if (this._eventRegistry) this._eventRegistry[eventName] = undefined;
864
+ if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined;
865
+ };
866
+
867
+ exports.EventEmitter = EventEmitter;
868
+
869
+ });
870
+
871
+ ace.define("ace/anchor",[], function(require, exports, module) {
872
+ "use strict";
873
+
874
+ var oop = require("./lib/oop");
875
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
876
+
877
+ var Anchor = exports.Anchor = function(doc, row, column) {
878
+ this.$onChange = this.onChange.bind(this);
879
+ this.attach(doc);
880
+
881
+ if (typeof column == "undefined")
882
+ this.setPosition(row.row, row.column);
883
+ else
884
+ this.setPosition(row, column);
885
+ };
886
+
887
+ (function() {
888
+
889
+ oop.implement(this, EventEmitter);
890
+ this.getPosition = function() {
891
+ return this.$clipPositionToDocument(this.row, this.column);
892
+ };
893
+ this.getDocument = function() {
894
+ return this.document;
895
+ };
896
+ this.$insertRight = false;
897
+ this.onChange = function(delta) {
898
+ if (delta.start.row == delta.end.row && delta.start.row != this.row)
899
+ return;
900
+
901
+ if (delta.start.row > this.row)
902
+ return;
903
+
904
+ var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
905
+ this.setPosition(point.row, point.column, true);
906
+ };
907
+
908
+ function $pointsInOrder(point1, point2, equalPointsInOrder) {
909
+ var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
910
+ return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
911
+ }
912
+
913
+ function $getTransformedPoint(delta, point, moveIfEqual) {
914
+ var deltaIsInsert = delta.action == "insert";
915
+ var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
916
+ var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
917
+ var deltaStart = delta.start;
918
+ var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
919
+ if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
920
+ return {
921
+ row: point.row,
922
+ column: point.column
923
+ };
924
+ }
925
+ if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
926
+ return {
927
+ row: point.row + deltaRowShift,
928
+ column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
929
+ };
930
+ }
931
+
932
+ return {
933
+ row: deltaStart.row,
934
+ column: deltaStart.column
935
+ };
936
+ }
937
+ this.setPosition = function(row, column, noClip) {
938
+ var pos;
939
+ if (noClip) {
940
+ pos = {
941
+ row: row,
942
+ column: column
943
+ };
944
+ } else {
945
+ pos = this.$clipPositionToDocument(row, column);
946
+ }
947
+
948
+ if (this.row == pos.row && this.column == pos.column)
949
+ return;
950
+
951
+ var old = {
952
+ row: this.row,
953
+ column: this.column
954
+ };
955
+
956
+ this.row = pos.row;
957
+ this.column = pos.column;
958
+ this._signal("change", {
959
+ old: old,
960
+ value: pos
961
+ });
962
+ };
963
+ this.detach = function() {
964
+ this.document.off("change", this.$onChange);
965
+ };
966
+ this.attach = function(doc) {
967
+ this.document = doc || this.document;
968
+ this.document.on("change", this.$onChange);
969
+ };
970
+ this.$clipPositionToDocument = function(row, column) {
971
+ var pos = {};
972
+
973
+ if (row >= this.document.getLength()) {
974
+ pos.row = Math.max(0, this.document.getLength() - 1);
975
+ pos.column = this.document.getLine(pos.row).length;
976
+ }
977
+ else if (row < 0) {
978
+ pos.row = 0;
979
+ pos.column = 0;
980
+ }
981
+ else {
982
+ pos.row = row;
983
+ pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
984
+ }
985
+
986
+ if (column < 0)
987
+ pos.column = 0;
988
+
989
+ return pos;
990
+ };
991
+
992
+ }).call(Anchor.prototype);
993
+
994
+ });
995
+
996
+ ace.define("ace/document",[], function(require, exports, module) {
997
+ "use strict";
998
+
999
+ var oop = require("./lib/oop");
1000
+ var applyDelta = require("./apply_delta").applyDelta;
1001
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
1002
+ var Range = require("./range").Range;
1003
+ var Anchor = require("./anchor").Anchor;
1004
+
1005
+ var Document = function(textOrLines) {
1006
+ this.$lines = [""];
1007
+ if (textOrLines.length === 0) {
1008
+ this.$lines = [""];
1009
+ } else if (Array.isArray(textOrLines)) {
1010
+ this.insertMergedLines({row: 0, column: 0}, textOrLines);
1011
+ } else {
1012
+ this.insert({row: 0, column:0}, textOrLines);
1013
+ }
1014
+ };
1015
+
1016
+ (function() {
1017
+
1018
+ oop.implement(this, EventEmitter);
1019
+ this.setValue = function(text) {
1020
+ var len = this.getLength() - 1;
1021
+ this.remove(new Range(0, 0, len, this.getLine(len).length));
1022
+ this.insert({row: 0, column: 0}, text);
1023
+ };
1024
+ this.getValue = function() {
1025
+ return this.getAllLines().join(this.getNewLineCharacter());
1026
+ };
1027
+ this.createAnchor = function(row, column) {
1028
+ return new Anchor(this, row, column);
1029
+ };
1030
+ if ("aaa".split(/a/).length === 0) {
1031
+ this.$split = function(text) {
1032
+ return text.replace(/\r\n|\r/g, "\n").split("\n");
1033
+ };
1034
+ } else {
1035
+ this.$split = function(text) {
1036
+ return text.split(/\r\n|\r|\n/);
1037
+ };
1038
+ }
1039
+
1040
+
1041
+ this.$detectNewLine = function(text) {
1042
+ var match = text.match(/^.*?(\r\n|\r|\n)/m);
1043
+ this.$autoNewLine = match ? match[1] : "\n";
1044
+ this._signal("changeNewLineMode");
1045
+ };
1046
+ this.getNewLineCharacter = function() {
1047
+ switch (this.$newLineMode) {
1048
+ case "windows":
1049
+ return "\r\n";
1050
+ case "unix":
1051
+ return "\n";
1052
+ default:
1053
+ return this.$autoNewLine || "\n";
1054
+ }
1055
+ };
1056
+
1057
+ this.$autoNewLine = "";
1058
+ this.$newLineMode = "auto";
1059
+ this.setNewLineMode = function(newLineMode) {
1060
+ if (this.$newLineMode === newLineMode)
1061
+ return;
1062
+
1063
+ this.$newLineMode = newLineMode;
1064
+ this._signal("changeNewLineMode");
1065
+ };
1066
+ this.getNewLineMode = function() {
1067
+ return this.$newLineMode;
1068
+ };
1069
+ this.isNewLine = function(text) {
1070
+ return (text == "\r\n" || text == "\r" || text == "\n");
1071
+ };
1072
+ this.getLine = function(row) {
1073
+ return this.$lines[row] || "";
1074
+ };
1075
+ this.getLines = function(firstRow, lastRow) {
1076
+ return this.$lines.slice(firstRow, lastRow + 1);
1077
+ };
1078
+ this.getAllLines = function() {
1079
+ return this.getLines(0, this.getLength());
1080
+ };
1081
+ this.getLength = function() {
1082
+ return this.$lines.length;
1083
+ };
1084
+ this.getTextRange = function(range) {
1085
+ return this.getLinesForRange(range).join(this.getNewLineCharacter());
1086
+ };
1087
+ this.getLinesForRange = function(range) {
1088
+ var lines;
1089
+ if (range.start.row === range.end.row) {
1090
+ lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
1091
+ } else {
1092
+ lines = this.getLines(range.start.row, range.end.row);
1093
+ lines[0] = (lines[0] || "").substring(range.start.column);
1094
+ var l = lines.length - 1;
1095
+ if (range.end.row - range.start.row == l)
1096
+ lines[l] = lines[l].substring(0, range.end.column);
1097
+ }
1098
+ return lines;
1099
+ };
1100
+ this.insertLines = function(row, lines) {
1101
+ console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
1102
+ return this.insertFullLines(row, lines);
1103
+ };
1104
+ this.removeLines = function(firstRow, lastRow) {
1105
+ console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
1106
+ return this.removeFullLines(firstRow, lastRow);
1107
+ };
1108
+ this.insertNewLine = function(position) {
1109
+ console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
1110
+ return this.insertMergedLines(position, ["", ""]);
1111
+ };
1112
+ this.insert = function(position, text) {
1113
+ if (this.getLength() <= 1)
1114
+ this.$detectNewLine(text);
1115
+
1116
+ return this.insertMergedLines(position, this.$split(text));
1117
+ };
1118
+ this.insertInLine = function(position, text) {
1119
+ var start = this.clippedPos(position.row, position.column);
1120
+ var end = this.pos(position.row, position.column + text.length);
1121
+
1122
+ this.applyDelta({
1123
+ start: start,
1124
+ end: end,
1125
+ action: "insert",
1126
+ lines: [text]
1127
+ }, true);
1128
+
1129
+ return this.clonePos(end);
1130
+ };
1131
+
1132
+ this.clippedPos = function(row, column) {
1133
+ var length = this.getLength();
1134
+ if (row === undefined) {
1135
+ row = length;
1136
+ } else if (row < 0) {
1137
+ row = 0;
1138
+ } else if (row >= length) {
1139
+ row = length - 1;
1140
+ column = undefined;
1141
+ }
1142
+ var line = this.getLine(row);
1143
+ if (column == undefined)
1144
+ column = line.length;
1145
+ column = Math.min(Math.max(column, 0), line.length);
1146
+ return {row: row, column: column};
1147
+ };
1148
+
1149
+ this.clonePos = function(pos) {
1150
+ return {row: pos.row, column: pos.column};
1151
+ };
1152
+
1153
+ this.pos = function(row, column) {
1154
+ return {row: row, column: column};
1155
+ };
1156
+
1157
+ this.$clipPosition = function(position) {
1158
+ var length = this.getLength();
1159
+ if (position.row >= length) {
1160
+ position.row = Math.max(0, length - 1);
1161
+ position.column = this.getLine(length - 1).length;
1162
+ } else {
1163
+ position.row = Math.max(0, position.row);
1164
+ position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
1165
+ }
1166
+ return position;
1167
+ };
1168
+ this.insertFullLines = function(row, lines) {
1169
+ row = Math.min(Math.max(row, 0), this.getLength());
1170
+ var column = 0;
1171
+ if (row < this.getLength()) {
1172
+ lines = lines.concat([""]);
1173
+ column = 0;
1174
+ } else {
1175
+ lines = [""].concat(lines);
1176
+ row--;
1177
+ column = this.$lines[row].length;
1178
+ }
1179
+ this.insertMergedLines({row: row, column: column}, lines);
1180
+ };
1181
+ this.insertMergedLines = function(position, lines) {
1182
+ var start = this.clippedPos(position.row, position.column);
1183
+ var end = {
1184
+ row: start.row + lines.length - 1,
1185
+ column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
1186
+ };
1187
+
1188
+ this.applyDelta({
1189
+ start: start,
1190
+ end: end,
1191
+ action: "insert",
1192
+ lines: lines
1193
+ });
1194
+
1195
+ return this.clonePos(end);
1196
+ };
1197
+ this.remove = function(range) {
1198
+ var start = this.clippedPos(range.start.row, range.start.column);
1199
+ var end = this.clippedPos(range.end.row, range.end.column);
1200
+ this.applyDelta({
1201
+ start: start,
1202
+ end: end,
1203
+ action: "remove",
1204
+ lines: this.getLinesForRange({start: start, end: end})
1205
+ });
1206
+ return this.clonePos(start);
1207
+ };
1208
+ this.removeInLine = function(row, startColumn, endColumn) {
1209
+ var start = this.clippedPos(row, startColumn);
1210
+ var end = this.clippedPos(row, endColumn);
1211
+
1212
+ this.applyDelta({
1213
+ start: start,
1214
+ end: end,
1215
+ action: "remove",
1216
+ lines: this.getLinesForRange({start: start, end: end})
1217
+ }, true);
1218
+
1219
+ return this.clonePos(start);
1220
+ };
1221
+ this.removeFullLines = function(firstRow, lastRow) {
1222
+ firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
1223
+ lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
1224
+ var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
1225
+ var deleteLastNewLine = lastRow < this.getLength() - 1;
1226
+ var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );
1227
+ var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );
1228
+ var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );
1229
+ var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length );
1230
+ var range = new Range(startRow, startCol, endRow, endCol);
1231
+ var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
1232
+
1233
+ this.applyDelta({
1234
+ start: range.start,
1235
+ end: range.end,
1236
+ action: "remove",
1237
+ lines: this.getLinesForRange(range)
1238
+ });
1239
+ return deletedLines;
1240
+ };
1241
+ this.removeNewLine = function(row) {
1242
+ if (row < this.getLength() - 1 && row >= 0) {
1243
+ this.applyDelta({
1244
+ start: this.pos(row, this.getLine(row).length),
1245
+ end: this.pos(row + 1, 0),
1246
+ action: "remove",
1247
+ lines: ["", ""]
1248
+ });
1249
+ }
1250
+ };
1251
+ this.replace = function(range, text) {
1252
+ if (!(range instanceof Range))
1253
+ range = Range.fromPoints(range.start, range.end);
1254
+ if (text.length === 0 && range.isEmpty())
1255
+ return range.start;
1256
+ if (text == this.getTextRange(range))
1257
+ return range.end;
1258
+
1259
+ this.remove(range);
1260
+ var end;
1261
+ if (text) {
1262
+ end = this.insert(range.start, text);
1263
+ }
1264
+ else {
1265
+ end = range.start;
1266
+ }
1267
+
1268
+ return end;
1269
+ };
1270
+ this.applyDeltas = function(deltas) {
1271
+ for (var i=0; i<deltas.length; i++) {
1272
+ this.applyDelta(deltas[i]);
1273
+ }
1274
+ };
1275
+ this.revertDeltas = function(deltas) {
1276
+ for (var i=deltas.length-1; i>=0; i--) {
1277
+ this.revertDelta(deltas[i]);
1278
+ }
1279
+ };
1280
+ this.applyDelta = function(delta, doNotValidate) {
1281
+ var isInsert = delta.action == "insert";
1282
+ if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
1283
+ : !Range.comparePoints(delta.start, delta.end)) {
1284
+ return;
1285
+ }
1286
+
1287
+ if (isInsert && delta.lines.length > 20000) {
1288
+ this.$splitAndapplyLargeDelta(delta, 20000);
1289
+ }
1290
+ else {
1291
+ applyDelta(this.$lines, delta, doNotValidate);
1292
+ this._signal("change", delta);
1293
+ }
1294
+ };
1295
+
1296
+ this.$safeApplyDelta = function(delta) {
1297
+ var docLength = this.$lines.length;
1298
+ if (
1299
+ delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength
1300
+ || delta.action == "insert" && delta.start.row <= docLength
1301
+ ) {
1302
+ this.applyDelta(delta);
1303
+ }
1304
+ };
1305
+
1306
+ this.$splitAndapplyLargeDelta = function(delta, MAX) {
1307
+ var lines = delta.lines;
1308
+ var l = lines.length - MAX + 1;
1309
+ var row = delta.start.row;
1310
+ var column = delta.start.column;
1311
+ for (var from = 0, to = 0; from < l; from = to) {
1312
+ to += MAX - 1;
1313
+ var chunk = lines.slice(from, to);
1314
+ chunk.push("");
1315
+ this.applyDelta({
1316
+ start: this.pos(row + from, column),
1317
+ end: this.pos(row + to, column = 0),
1318
+ action: delta.action,
1319
+ lines: chunk
1320
+ }, true);
1321
+ }
1322
+ delta.lines = lines.slice(from);
1323
+ delta.start.row = row + from;
1324
+ delta.start.column = column;
1325
+ this.applyDelta(delta, true);
1326
+ };
1327
+ this.revertDelta = function(delta) {
1328
+ this.$safeApplyDelta({
1329
+ start: this.clonePos(delta.start),
1330
+ end: this.clonePos(delta.end),
1331
+ action: (delta.action == "insert" ? "remove" : "insert"),
1332
+ lines: delta.lines.slice()
1333
+ });
1334
+ };
1335
+ this.indexToPosition = function(index, startRow) {
1336
+ var lines = this.$lines || this.getAllLines();
1337
+ var newlineLength = this.getNewLineCharacter().length;
1338
+ for (var i = startRow || 0, l = lines.length; i < l; i++) {
1339
+ index -= lines[i].length + newlineLength;
1340
+ if (index < 0)
1341
+ return {row: i, column: index + lines[i].length + newlineLength};
1342
+ }
1343
+ return {row: l-1, column: index + lines[l-1].length + newlineLength};
1344
+ };
1345
+ this.positionToIndex = function(pos, startRow) {
1346
+ var lines = this.$lines || this.getAllLines();
1347
+ var newlineLength = this.getNewLineCharacter().length;
1348
+ var index = 0;
1349
+ var row = Math.min(pos.row, lines.length);
1350
+ for (var i = startRow || 0; i < row; ++i)
1351
+ index += lines[i].length + newlineLength;
1352
+
1353
+ return index + pos.column;
1354
+ };
1355
+
1356
+ }).call(Document.prototype);
1357
+
1358
+ exports.Document = Document;
1359
+ });
1360
+
1361
+ ace.define("ace/worker/mirror",[], function(require, exports, module) {
1362
+ "use strict";
1363
+
1364
+ var Range = require("../range").Range;
1365
+ var Document = require("../document").Document;
1366
+ var lang = require("../lib/lang");
1367
+
1368
+ var Mirror = exports.Mirror = function(sender) {
1369
+ this.sender = sender;
1370
+ var doc = this.doc = new Document("");
1371
+
1372
+ var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1373
+
1374
+ var _self = this;
1375
+ sender.on("change", function(e) {
1376
+ var data = e.data;
1377
+ if (data[0].start) {
1378
+ doc.applyDeltas(data);
1379
+ } else {
1380
+ for (var i = 0; i < data.length; i += 2) {
1381
+ if (Array.isArray(data[i+1])) {
1382
+ var d = {action: "insert", start: data[i], lines: data[i+1]};
1383
+ } else {
1384
+ var d = {action: "remove", start: data[i], end: data[i+1]};
1385
+ }
1386
+ doc.applyDelta(d, true);
1387
+ }
1388
+ }
1389
+ if (_self.$timeout)
1390
+ return deferredUpdate.schedule(_self.$timeout);
1391
+ _self.onUpdate();
1392
+ });
1393
+ };
1394
+
1395
+ (function() {
1396
+
1397
+ this.$timeout = 500;
1398
+
1399
+ this.setTimeout = function(timeout) {
1400
+ this.$timeout = timeout;
1401
+ };
1402
+
1403
+ this.setValue = function(value) {
1404
+ this.doc.setValue(value);
1405
+ this.deferredUpdate.schedule(this.$timeout);
1406
+ };
1407
+
1408
+ this.getValue = function(callbackId) {
1409
+ this.sender.callback(this.doc.getValue(), callbackId);
1410
+ };
1411
+
1412
+ this.onUpdate = function() {
1413
+ };
1414
+
1415
+ this.isPending = function() {
1416
+ return this.deferredUpdate.isPending();
1417
+ };
1418
+
1419
+ }).call(Mirror.prototype);
1420
+
1421
+ });
1422
+
1423
+ ace.define("ace/mode/xml/sax",[], function(require, exports, module) {
1424
+ var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF
1425
+ var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\u00B7\u0300-\u036F\\ux203F-\u2040]");
1426
+ var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
1427
+ var S_TAG = 0;//tag name offerring
1428
+ var S_ATTR = 1;//attr name offerring
1429
+ var S_ATTR_S=2;//attr name end and space offer
1430
+ var S_EQ = 3;//=space?
1431
+ var S_V = 4;//attr value(no quot value only)
1432
+ var S_E = 5;//attr value end and no space(quot end)
1433
+ var S_S = 6;//(attr value end || tag end ) && (space offer)
1434
+ var S_C = 7;//closed el<el />
1435
+
1436
+ function XMLReader(){
1437
+
1438
+ }
1439
+
1440
+ XMLReader.prototype = {
1441
+ parse:function(source,defaultNSMap,entityMap){
1442
+ var domBuilder = this.domBuilder;
1443
+ domBuilder.startDocument();
1444
+ _copy(defaultNSMap ,defaultNSMap = {})
1445
+ parse(source,defaultNSMap,entityMap,
1446
+ domBuilder,this.errorHandler);
1447
+ domBuilder.endDocument();
1448
+ }
1449
+ }
1450
+ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
1451
+ function fixedFromCharCode(code) {
1452
+ if (code > 0xffff) {
1453
+ code -= 0x10000;
1454
+ var surrogate1 = 0xd800 + (code >> 10)
1455
+ , surrogate2 = 0xdc00 + (code & 0x3ff);
1456
+
1457
+ return String.fromCharCode(surrogate1, surrogate2);
1458
+ } else {
1459
+ return String.fromCharCode(code);
1460
+ }
1461
+ }
1462
+ function entityReplacer(a){
1463
+ var k = a.slice(1,-1);
1464
+ if(k in entityMap){
1465
+ return entityMap[k];
1466
+ }else if(k.charAt(0) === '#'){
1467
+ return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))
1468
+ }else{
1469
+ errorHandler.error('entity not found:'+a);
1470
+ return a;
1471
+ }
1472
+ }
1473
+ function appendText(end){//has some bugs
1474
+ var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer);
1475
+ locator&&position(start);
1476
+ domBuilder.characters(xt,0,end-start);
1477
+ start = end
1478
+ }
1479
+ function position(start,m){
1480
+ while(start>=endPos && (m = linePattern.exec(source))){
1481
+ startPos = m.index;
1482
+ endPos = startPos + m[0].length;
1483
+ locator.lineNumber++;
1484
+ }
1485
+ locator.columnNumber = start-startPos+1;
1486
+ }
1487
+ var startPos = 0;
1488
+ var endPos = 0;
1489
+ var linePattern = /.+(?:\r\n?|\n)|.*$/g
1490
+ var locator = domBuilder.locator;
1491
+
1492
+ var parseStack = [{currentNSMap:defaultNSMapCopy}]
1493
+ var closeMap = {};
1494
+ var start = 0;
1495
+ while(true){
1496
+ var i = source.indexOf('<',start);
1497
+ if(i<0){
1498
+ if(!source.substr(start).match(/^\s*$/)){
1499
+ var doc = domBuilder.document;
1500
+ var text = doc.createTextNode(source.substr(start));
1501
+ doc.appendChild(text);
1502
+ domBuilder.currentElement = text;
1503
+ }
1504
+ return;
1505
+ }
1506
+ if(i>start){
1507
+ appendText(i);
1508
+ }
1509
+ switch(source.charAt(i+1)){
1510
+ case '/':
1511
+ var end = source.indexOf('>',i+3);
1512
+ var tagName = source.substring(i+2,end);
1513
+ var config;
1514
+ if (parseStack.length > 1) {
1515
+ config = parseStack.pop();
1516
+ } else {
1517
+ errorHandler.fatalError("end tag name not found for: "+tagName);
1518
+ break;
1519
+ }
1520
+ var localNSMap = config.localNSMap;
1521
+
1522
+ if(config.tagName != tagName){
1523
+ errorHandler.fatalError("end tag name: " + tagName + " does not match the current start tagName: "+config.tagName );
1524
+ }
1525
+ domBuilder.endElement(config.uri,config.localName,tagName);
1526
+ if(localNSMap){
1527
+ for(var prefix in localNSMap){
1528
+ domBuilder.endPrefixMapping(prefix) ;
1529
+ }
1530
+ }
1531
+ end++;
1532
+ break;
1533
+ case '?':// <?...?>
1534
+ locator&&position(i);
1535
+ end = parseInstruction(source,i,domBuilder);
1536
+ break;
1537
+ case '!':// <!doctype,<![CDATA,<!--
1538
+ locator&&position(i);
1539
+ end = parseDCC(source,i,domBuilder,errorHandler);
1540
+ break;
1541
+ default:
1542
+ try{
1543
+ locator&&position(i);
1544
+
1545
+ var el = new ElementAttributes();
1546
+ var end = parseElementStartPart(source,i,el,entityReplacer,errorHandler);
1547
+ var len = el.length;
1548
+ if(len && locator){
1549
+ var backup = copyLocator(locator,{});
1550
+ for(var i = 0;i<len;i++){
1551
+ var a = el[i];
1552
+ position(a.offset);
1553
+ a.offset = copyLocator(locator,{});
1554
+ }
1555
+ copyLocator(backup,locator);
1556
+ }
1557
+ if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){
1558
+ el.closed = true;
1559
+ if(!entityMap.nbsp){
1560
+ errorHandler.warning('unclosed xml attribute');
1561
+ }
1562
+ }
1563
+ appendElement(el,domBuilder,parseStack);
1564
+
1565
+
1566
+ if(el.uri === 'http://www.w3.org/1999/xhtml' && !el.closed){
1567
+ end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder)
1568
+ }else{
1569
+ end++;
1570
+ }
1571
+ }catch(e){
1572
+ errorHandler.error('element parse error: '+e);
1573
+ end = -1;
1574
+ }
1575
+
1576
+ }
1577
+ if(end<0){
1578
+ appendText(i+1);
1579
+ }else{
1580
+ start = end;
1581
+ }
1582
+ }
1583
+ }
1584
+ function copyLocator(f,t){
1585
+ t.lineNumber = f.lineNumber;
1586
+ t.columnNumber = f.columnNumber;
1587
+ return t;
1588
+
1589
+ }
1590
+ function parseElementStartPart(source,start,el,entityReplacer,errorHandler){
1591
+ var attrName;
1592
+ var value;
1593
+ var p = ++start;
1594
+ var s = S_TAG;//status
1595
+ while(true){
1596
+ var c = source.charAt(p);
1597
+ switch(c){
1598
+ case '=':
1599
+ if(s === S_ATTR){//attrName
1600
+ attrName = source.slice(start,p);
1601
+ s = S_EQ;
1602
+ }else if(s === S_ATTR_S){
1603
+ s = S_EQ;
1604
+ }else{
1605
+ throw new Error('attribute equal must after attrName');
1606
+ }
1607
+ break;
1608
+ case '\'':
1609
+ case '"':
1610
+ if(s === S_EQ){//equal
1611
+ start = p+1;
1612
+ p = source.indexOf(c,start)
1613
+ if(p>0){
1614
+ value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
1615
+ el.add(attrName,value,start-1);
1616
+ s = S_E;
1617
+ }else{
1618
+ throw new Error('attribute value no end \''+c+'\' match');
1619
+ }
1620
+ }else if(s == S_V){
1621
+ value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
1622
+ el.add(attrName,value,start);
1623
+ errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!');
1624
+ start = p+1;
1625
+ s = S_E
1626
+ }else{
1627
+ throw new Error('attribute value must after "="');
1628
+ }
1629
+ break;
1630
+ case '/':
1631
+ switch(s){
1632
+ case S_TAG:
1633
+ el.setTagName(source.slice(start,p));
1634
+ case S_E:
1635
+ case S_S:
1636
+ case S_C:
1637
+ s = S_C;
1638
+ el.closed = true;
1639
+ case S_V:
1640
+ case S_ATTR:
1641
+ case S_ATTR_S:
1642
+ break;
1643
+ default:
1644
+ throw new Error("attribute invalid close char('/')")
1645
+ }
1646
+ break;
1647
+ case ''://end document
1648
+ errorHandler.error('unexpected end of input');
1649
+ case '>':
1650
+ switch(s){
1651
+ case S_TAG:
1652
+ el.setTagName(source.slice(start,p));
1653
+ case S_E:
1654
+ case S_S:
1655
+ case S_C:
1656
+ break;//normal
1657
+ case S_V://Compatible state
1658
+ case S_ATTR:
1659
+ value = source.slice(start,p);
1660
+ if(value.slice(-1) === '/'){
1661
+ el.closed = true;
1662
+ value = value.slice(0,-1)
1663
+ }
1664
+ case S_ATTR_S:
1665
+ if(s === S_ATTR_S){
1666
+ value = attrName;
1667
+ }
1668
+ if(s == S_V){
1669
+ errorHandler.warning('attribute "'+value+'" missed quot(")!!');
1670
+ el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start)
1671
+ }else{
1672
+ errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!')
1673
+ el.add(value,value,start)
1674
+ }
1675
+ break;
1676
+ case S_EQ:
1677
+ throw new Error('attribute value missed!!');
1678
+ }
1679
+ return p;
1680
+ case '\u0080':
1681
+ c = ' ';
1682
+ default:
1683
+ if(c<= ' '){//space
1684
+ switch(s){
1685
+ case S_TAG:
1686
+ el.setTagName(source.slice(start,p));//tagName
1687
+ s = S_S;
1688
+ break;
1689
+ case S_ATTR:
1690
+ attrName = source.slice(start,p)
1691
+ s = S_ATTR_S;
1692
+ break;
1693
+ case S_V:
1694
+ var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
1695
+ errorHandler.warning('attribute "'+value+'" missed quot(")!!');
1696
+ el.add(attrName,value,start)
1697
+ case S_E:
1698
+ s = S_S;
1699
+ break;
1700
+ }
1701
+ }else{//not space
1702
+ switch(s){
1703
+ case S_ATTR_S:
1704
+ errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead!!')
1705
+ el.add(attrName,attrName,start);
1706
+ start = p;
1707
+ s = S_ATTR;
1708
+ break;
1709
+ case S_E:
1710
+ errorHandler.warning('attribute space is required"'+attrName+'"!!')
1711
+ case S_S:
1712
+ s = S_ATTR;
1713
+ start = p;
1714
+ break;
1715
+ case S_EQ:
1716
+ s = S_V;
1717
+ start = p;
1718
+ break;
1719
+ case S_C:
1720
+ throw new Error("elements closed character '/' and '>' must be connected to");
1721
+ }
1722
+ }
1723
+ }
1724
+ p++;
1725
+ }
1726
+ }
1727
+ function appendElement(el,domBuilder,parseStack){
1728
+ var tagName = el.tagName;
1729
+ var localNSMap = null;
1730
+ var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
1731
+ var i = el.length;
1732
+ while(i--){
1733
+ var a = el[i];
1734
+ var qName = a.qName;
1735
+ var value = a.value;
1736
+ var nsp = qName.indexOf(':');
1737
+ if(nsp>0){
1738
+ var prefix = a.prefix = qName.slice(0,nsp);
1739
+ var localName = qName.slice(nsp+1);
1740
+ var nsPrefix = prefix === 'xmlns' && localName
1741
+ }else{
1742
+ localName = qName;
1743
+ prefix = null
1744
+ nsPrefix = qName === 'xmlns' && ''
1745
+ }
1746
+ a.localName = localName ;
1747
+ if(nsPrefix !== false){//hack!!
1748
+ if(localNSMap == null){
1749
+ localNSMap = {}
1750
+ _copy(currentNSMap,currentNSMap={})
1751
+ }
1752
+ currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
1753
+ a.uri = 'http://www.w3.org/2000/xmlns/'
1754
+ domBuilder.startPrefixMapping(nsPrefix, value)
1755
+ }
1756
+ }
1757
+ var i = el.length;
1758
+ while(i--){
1759
+ a = el[i];
1760
+ var prefix = a.prefix;
1761
+ if(prefix){//no prefix attribute has no namespace
1762
+ if(prefix === 'xml'){
1763
+ a.uri = 'http://www.w3.org/XML/1998/namespace';
1764
+ }if(prefix !== 'xmlns'){
1765
+ a.uri = currentNSMap[prefix]
1766
+ }
1767
+ }
1768
+ }
1769
+ var nsp = tagName.indexOf(':');
1770
+ if(nsp>0){
1771
+ prefix = el.prefix = tagName.slice(0,nsp);
1772
+ localName = el.localName = tagName.slice(nsp+1);
1773
+ }else{
1774
+ prefix = null;//important!!
1775
+ localName = el.localName = tagName;
1776
+ }
1777
+ var ns = el.uri = currentNSMap[prefix || ''];
1778
+ domBuilder.startElement(ns,localName,tagName,el);
1779
+ if(el.closed){
1780
+ domBuilder.endElement(ns,localName,tagName);
1781
+ if(localNSMap){
1782
+ for(prefix in localNSMap){
1783
+ domBuilder.endPrefixMapping(prefix)
1784
+ }
1785
+ }
1786
+ }else{
1787
+ el.currentNSMap = currentNSMap;
1788
+ el.localNSMap = localNSMap;
1789
+ parseStack.push(el);
1790
+ }
1791
+ }
1792
+ function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){
1793
+ if(/^(?:script|textarea)$/i.test(tagName)){
1794
+ var elEndStart = source.indexOf('</'+tagName+'>',elStartEnd);
1795
+ var text = source.substring(elStartEnd+1,elEndStart);
1796
+ if(/[&<]/.test(text)){
1797
+ if(/^script$/i.test(tagName)){
1798
+ domBuilder.characters(text,0,text.length);
1799
+ return elEndStart;
1800
+ }//}else{//text area
1801
+ text = text.replace(/&#?\w+;/g,entityReplacer);
1802
+ domBuilder.characters(text,0,text.length);
1803
+ return elEndStart;
1804
+
1805
+ }
1806
+ }
1807
+ return elStartEnd+1;
1808
+ }
1809
+ function fixSelfClosed(source,elStartEnd,tagName,closeMap){
1810
+ var pos = closeMap[tagName];
1811
+ if(pos == null){
1812
+ pos = closeMap[tagName] = source.lastIndexOf('</'+tagName+'>')
1813
+ }
1814
+ return pos<elStartEnd;
1815
+ }
1816
+ function _copy(source,target){
1817
+ for(var n in source){target[n] = source[n]}
1818
+ }
1819
+ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
1820
+ var next= source.charAt(start+2)
1821
+ switch(next){
1822
+ case '-':
1823
+ if(source.charAt(start + 3) === '-'){
1824
+ var end = source.indexOf('-->',start+4);
1825
+ if(end>start){
1826
+ domBuilder.comment(source,start+4,end-start-4);
1827
+ return end+3;
1828
+ }else{
1829
+ errorHandler.error("Unclosed comment");
1830
+ return -1;
1831
+ }
1832
+ }else{
1833
+ return -1;
1834
+ }
1835
+ default:
1836
+ if(source.substr(start+3,6) == 'CDATA['){
1837
+ var end = source.indexOf(']]>',start+9);
1838
+ if (end > start) {
1839
+ domBuilder.startCDATA();
1840
+ domBuilder.characters(source,start+9,end-start-9);
1841
+ domBuilder.endCDATA()
1842
+ return end+3;
1843
+ } else {
1844
+ errorHandler.error("Unclosed CDATA");
1845
+ return -1;
1846
+ }
1847
+ }
1848
+ var matchs = split(source,start);
1849
+ var len = matchs.length;
1850
+ if(len>1 && /!doctype/i.test(matchs[0][0])){
1851
+ var name = matchs[1][0];
1852
+ var pubid = len>3 && /^public$/i.test(matchs[2][0]) && matchs[3][0]
1853
+ var sysid = len>4 && matchs[4][0];
1854
+ var lastMatch = matchs[len-1]
1855
+ domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'),
1856
+ sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2'));
1857
+ domBuilder.endDTD();
1858
+
1859
+ return lastMatch.index+lastMatch[0].length
1860
+ }
1861
+ }
1862
+ return -1;
1863
+ }
1864
+
1865
+
1866
+
1867
+ function parseInstruction(source,start,domBuilder){
1868
+ var end = source.indexOf('?>',start);
1869
+ if(end){
1870
+ var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
1871
+ if(match){
1872
+ var len = match[0].length;
1873
+ domBuilder.processingInstruction(match[1], match[2]) ;
1874
+ return end+2;
1875
+ }else{//error
1876
+ return -1;
1877
+ }
1878
+ }
1879
+ return -1;
1880
+ }
1881
+ function ElementAttributes(source){
1882
+
1883
+ }
1884
+ ElementAttributes.prototype = {
1885
+ setTagName:function(tagName){
1886
+ if(!tagNamePattern.test(tagName)){
1887
+ throw new Error('invalid tagName:'+tagName)
1888
+ }
1889
+ this.tagName = tagName
1890
+ },
1891
+ add:function(qName,value,offset){
1892
+ if(!tagNamePattern.test(qName)){
1893
+ throw new Error('invalid attribute:'+qName)
1894
+ }
1895
+ this[this.length++] = {qName:qName,value:value,offset:offset}
1896
+ },
1897
+ length:0,
1898
+ getLocalName:function(i){return this[i].localName},
1899
+ getOffset:function(i){return this[i].offset},
1900
+ getQName:function(i){return this[i].qName},
1901
+ getURI:function(i){return this[i].uri},
1902
+ getValue:function(i){return this[i].value}
1903
+ }
1904
+
1905
+
1906
+
1907
+
1908
+ function _set_proto_(thiz,parent){
1909
+ thiz.__proto__ = parent;
1910
+ return thiz;
1911
+ }
1912
+ if(!(_set_proto_({},_set_proto_.prototype) instanceof _set_proto_)){
1913
+ _set_proto_ = function(thiz,parent){
1914
+ function p(){};
1915
+ p.prototype = parent;
1916
+ p = new p();
1917
+ for(parent in thiz){
1918
+ p[parent] = thiz[parent];
1919
+ }
1920
+ return p;
1921
+ }
1922
+ }
1923
+
1924
+ function split(source,start){
1925
+ var match;
1926
+ var buf = [];
1927
+ var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
1928
+ reg.lastIndex = start;
1929
+ reg.exec(source);//skip <
1930
+ while(match = reg.exec(source)){
1931
+ buf.push(match);
1932
+ if(match[1])return buf;
1933
+ }
1934
+ }
1935
+
1936
+ return XMLReader;
1937
+ });
1938
+
1939
+ ace.define("ace/mode/xml/dom",[], function(require, exports, module) {
1940
+
1941
+ function copy(src,dest){
1942
+ for(var p in src){
1943
+ dest[p] = src[p];
1944
+ }
1945
+ }
1946
+ function _extends(Class,Super){
1947
+ var t = function(){};
1948
+ var pt = Class.prototype;
1949
+ if(Object.create){
1950
+ var ppt = Object.create(Super.prototype);
1951
+ pt.__proto__ = ppt;
1952
+ }
1953
+ if(!(pt instanceof Super)){
1954
+ t.prototype = Super.prototype;
1955
+ t = new t();
1956
+ copy(pt,t);
1957
+ Class.prototype = pt = t;
1958
+ }
1959
+ if(pt.constructor != Class){
1960
+ if(typeof Class != 'function'){
1961
+ console.error("unknown Class:"+Class);
1962
+ }
1963
+ pt.constructor = Class;
1964
+ }
1965
+ }
1966
+ var htmlns = 'http://www.w3.org/1999/xhtml' ;
1967
+ var NodeType = {};
1968
+ var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
1969
+ var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
1970
+ var TEXT_NODE = NodeType.TEXT_NODE = 3;
1971
+ var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
1972
+ var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
1973
+ var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
1974
+ var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
1975
+ var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
1976
+ var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
1977
+ var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
1978
+ var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
1979
+ var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
1980
+ var ExceptionCode = {};
1981
+ var ExceptionMessage = {};
1982
+ var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]="Index size error"),1);
1983
+ var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2);
1984
+ var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3);
1985
+ var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4);
1986
+ var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
1987
+ var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6);
1988
+ var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7);
1989
+ var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8);
1990
+ var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9);
1991
+ var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10);
1992
+ var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
1993
+ var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12);
1994
+ var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13);
1995
+ var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14);
1996
+ var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = ((ExceptionMessage[15]="Invalid access"),15);
1997
+
1998
+
1999
+ function DOMException(code, message) {
2000
+ if(message instanceof Error){
2001
+ var error = message;
2002
+ }else{
2003
+ error = this;
2004
+ Error.call(this, ExceptionMessage[code]);
2005
+ this.message = ExceptionMessage[code];
2006
+ if(Error.captureStackTrace) Error.captureStackTrace(this, DOMException);
2007
+ }
2008
+ error.code = code;
2009
+ if(message) this.message = this.message + ": " + message;
2010
+ return error;
2011
+ };
2012
+ DOMException.prototype = Error.prototype;
2013
+ copy(ExceptionCode,DOMException)
2014
+ function NodeList() {
2015
+ };
2016
+ NodeList.prototype = {
2017
+ length:0,
2018
+ item: function(index) {
2019
+ return this[index] || null;
2020
+ }
2021
+ };
2022
+ function LiveNodeList(node,refresh){
2023
+ this._node = node;
2024
+ this._refresh = refresh;
2025
+ _updateLiveList(this);
2026
+ }
2027
+ function _updateLiveList(list){
2028
+ var inc = list._node._inc || list._node.ownerDocument._inc;
2029
+ if(list._inc != inc){
2030
+ var ls = list._refresh(list._node);
2031
+ __set__(list,'length',ls.length);
2032
+ copy(ls,list);
2033
+ list._inc = inc;
2034
+ }
2035
+ }
2036
+ LiveNodeList.prototype.item = function(i){
2037
+ _updateLiveList(this);
2038
+ return this[i];
2039
+ }
2040
+
2041
+ _extends(LiveNodeList,NodeList);
2042
+ function NamedNodeMap() {
2043
+ };
2044
+
2045
+ function _findNodeIndex(list,node){
2046
+ var i = list.length;
2047
+ while(i--){
2048
+ if(list[i] === node){return i}
2049
+ }
2050
+ }
2051
+
2052
+ function _addNamedNode(el,list,newAttr,oldAttr){
2053
+ if(oldAttr){
2054
+ list[_findNodeIndex(list,oldAttr)] = newAttr;
2055
+ }else{
2056
+ list[list.length++] = newAttr;
2057
+ }
2058
+ if(el){
2059
+ newAttr.ownerElement = el;
2060
+ var doc = el.ownerDocument;
2061
+ if(doc){
2062
+ oldAttr && _onRemoveAttribute(doc,el,oldAttr);
2063
+ _onAddAttribute(doc,el,newAttr);
2064
+ }
2065
+ }
2066
+ }
2067
+ function _removeNamedNode(el,list,attr){
2068
+ var i = _findNodeIndex(list,attr);
2069
+ if(i>=0){
2070
+ var lastIndex = list.length-1;
2071
+ while(i<lastIndex){
2072
+ list[i] = list[++i];
2073
+ }
2074
+ list.length = lastIndex;
2075
+ if(el){
2076
+ var doc = el.ownerDocument;
2077
+ if(doc){
2078
+ _onRemoveAttribute(doc,el,attr);
2079
+ attr.ownerElement = null;
2080
+ }
2081
+ }
2082
+ }else{
2083
+ throw new DOMException(NOT_FOUND_ERR,new Error());
2084
+ }
2085
+ }
2086
+ NamedNodeMap.prototype = {
2087
+ length:0,
2088
+ item:NodeList.prototype.item,
2089
+ getNamedItem: function(key) {
2090
+ var i = this.length;
2091
+ while(i--){
2092
+ var attr = this[i];
2093
+ if(attr.nodeName == key){
2094
+ return attr;
2095
+ }
2096
+ }
2097
+ },
2098
+ setNamedItem: function(attr) {
2099
+ var el = attr.ownerElement;
2100
+ if(el && el!=this._ownerElement){
2101
+ throw new DOMException(INUSE_ATTRIBUTE_ERR);
2102
+ }
2103
+ var oldAttr = this.getNamedItem(attr.nodeName);
2104
+ _addNamedNode(this._ownerElement,this,attr,oldAttr);
2105
+ return oldAttr;
2106
+ },
2107
+ setNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR
2108
+ var el = attr.ownerElement, oldAttr;
2109
+ if(el && el!=this._ownerElement){
2110
+ throw new DOMException(INUSE_ATTRIBUTE_ERR);
2111
+ }
2112
+ oldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName);
2113
+ _addNamedNode(this._ownerElement,this,attr,oldAttr);
2114
+ return oldAttr;
2115
+ },
2116
+ removeNamedItem: function(key) {
2117
+ var attr = this.getNamedItem(key);
2118
+ _removeNamedNode(this._ownerElement,this,attr);
2119
+ return attr;
2120
+
2121
+
2122
+ },// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR
2123
+ removeNamedItemNS:function(namespaceURI,localName){
2124
+ var attr = this.getNamedItemNS(namespaceURI,localName);
2125
+ _removeNamedNode(this._ownerElement,this,attr);
2126
+ return attr;
2127
+ },
2128
+ getNamedItemNS: function(namespaceURI, localName) {
2129
+ var i = this.length;
2130
+ while(i--){
2131
+ var node = this[i];
2132
+ if(node.localName == localName && node.namespaceURI == namespaceURI){
2133
+ return node;
2134
+ }
2135
+ }
2136
+ return null;
2137
+ }
2138
+ };
2139
+ function DOMImplementation(/* Object */ features) {
2140
+ this._features = {};
2141
+ if (features) {
2142
+ for (var feature in features) {
2143
+ this._features = features[feature];
2144
+ }
2145
+ }
2146
+ };
2147
+
2148
+ DOMImplementation.prototype = {
2149
+ hasFeature: function(/* string */ feature, /* string */ version) {
2150
+ var versions = this._features[feature.toLowerCase()];
2151
+ if (versions && (!version || version in versions)) {
2152
+ return true;
2153
+ } else {
2154
+ return false;
2155
+ }
2156
+ },
2157
+ createDocument:function(namespaceURI, qualifiedName, doctype){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR,WRONG_DOCUMENT_ERR
2158
+ var doc = new Document();
2159
+ doc.implementation = this;
2160
+ doc.childNodes = new NodeList();
2161
+ doc.doctype = doctype;
2162
+ if(doctype){
2163
+ doc.appendChild(doctype);
2164
+ }
2165
+ if(qualifiedName){
2166
+ var root = doc.createElementNS(namespaceURI,qualifiedName);
2167
+ doc.appendChild(root);
2168
+ }
2169
+ return doc;
2170
+ },
2171
+ createDocumentType:function(qualifiedName, publicId, systemId){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR
2172
+ var node = new DocumentType();
2173
+ node.name = qualifiedName;
2174
+ node.nodeName = qualifiedName;
2175
+ node.publicId = publicId;
2176
+ node.systemId = systemId;
2177
+ return node;
2178
+ }
2179
+ };
2180
+
2181
+ function Node() {
2182
+ };
2183
+
2184
+ Node.prototype = {
2185
+ firstChild : null,
2186
+ lastChild : null,
2187
+ previousSibling : null,
2188
+ nextSibling : null,
2189
+ attributes : null,
2190
+ parentNode : null,
2191
+ childNodes : null,
2192
+ ownerDocument : null,
2193
+ nodeValue : null,
2194
+ namespaceURI : null,
2195
+ prefix : null,
2196
+ localName : null,
2197
+ insertBefore:function(newChild, refChild){//raises
2198
+ return _insertBefore(this,newChild,refChild);
2199
+ },
2200
+ replaceChild:function(newChild, oldChild){//raises
2201
+ this.insertBefore(newChild,oldChild);
2202
+ if(oldChild){
2203
+ this.removeChild(oldChild);
2204
+ }
2205
+ },
2206
+ removeChild:function(oldChild){
2207
+ return _removeChild(this,oldChild);
2208
+ },
2209
+ appendChild:function(newChild){
2210
+ return this.insertBefore(newChild,null);
2211
+ },
2212
+ hasChildNodes:function(){
2213
+ return this.firstChild != null;
2214
+ },
2215
+ cloneNode:function(deep){
2216
+ return cloneNode(this.ownerDocument||this,this,deep);
2217
+ },
2218
+ normalize:function(){
2219
+ var child = this.firstChild;
2220
+ while(child){
2221
+ var next = child.nextSibling;
2222
+ if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){
2223
+ this.removeChild(next);
2224
+ child.appendData(next.data);
2225
+ }else{
2226
+ child.normalize();
2227
+ child = next;
2228
+ }
2229
+ }
2230
+ },
2231
+ isSupported:function(feature, version){
2232
+ return this.ownerDocument.implementation.hasFeature(feature,version);
2233
+ },
2234
+ hasAttributes:function(){
2235
+ return this.attributes.length>0;
2236
+ },
2237
+ lookupPrefix:function(namespaceURI){
2238
+ var el = this;
2239
+ while(el){
2240
+ var map = el._nsMap;
2241
+ if(map){
2242
+ for(var n in map){
2243
+ if(map[n] == namespaceURI){
2244
+ return n;
2245
+ }
2246
+ }
2247
+ }
2248
+ el = el.nodeType == 2?el.ownerDocument : el.parentNode;
2249
+ }
2250
+ return null;
2251
+ },
2252
+ lookupNamespaceURI:function(prefix){
2253
+ var el = this;
2254
+ while(el){
2255
+ var map = el._nsMap;
2256
+ if(map){
2257
+ if(prefix in map){
2258
+ return map[prefix] ;
2259
+ }
2260
+ }
2261
+ el = el.nodeType == 2?el.ownerDocument : el.parentNode;
2262
+ }
2263
+ return null;
2264
+ },
2265
+ isDefaultNamespace:function(namespaceURI){
2266
+ var prefix = this.lookupPrefix(namespaceURI);
2267
+ return prefix == null;
2268
+ }
2269
+ };
2270
+
2271
+
2272
+ function _xmlEncoder(c){
2273
+ return c == '<' && '&lt;' ||
2274
+ c == '>' && '&gt;' ||
2275
+ c == '&' && '&amp;' ||
2276
+ c == '"' && '&quot;' ||
2277
+ '&#'+c.charCodeAt()+';';
2278
+ }
2279
+
2280
+
2281
+ copy(NodeType,Node);
2282
+ copy(NodeType,Node.prototype);
2283
+ function _visitNode(node,callback){
2284
+ if(callback(node)){
2285
+ return true;
2286
+ }
2287
+ if(node = node.firstChild){
2288
+ do{
2289
+ if(_visitNode(node,callback)){return true}
2290
+ }while(node=node.nextSibling)
2291
+ }
2292
+ }
2293
+
2294
+
2295
+
2296
+ function Document(){
2297
+ }
2298
+ function _onAddAttribute(doc,el,newAttr){
2299
+ doc && doc._inc++;
2300
+ var ns = newAttr.namespaceURI ;
2301
+ if(ns == 'http://www.w3.org/2000/xmlns/'){
2302
+ el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value
2303
+ }
2304
+ }
2305
+ function _onRemoveAttribute(doc,el,newAttr,remove){
2306
+ doc && doc._inc++;
2307
+ var ns = newAttr.namespaceURI ;
2308
+ if(ns == 'http://www.w3.org/2000/xmlns/'){
2309
+ delete el._nsMap[newAttr.prefix?newAttr.localName:''];
2310
+ }
2311
+ }
2312
+ function _onUpdateChild(doc,el,newChild){
2313
+ if(doc && doc._inc){
2314
+ doc._inc++;
2315
+ var cs = el.childNodes;
2316
+ if(newChild){
2317
+ cs[cs.length++] = newChild;
2318
+ }else{
2319
+ var child = el.firstChild;
2320
+ var i = 0;
2321
+ while(child){
2322
+ cs[i++] = child;
2323
+ child =child.nextSibling;
2324
+ }
2325
+ cs.length = i;
2326
+ }
2327
+ }
2328
+ }
2329
+ function _removeChild(parentNode,child){
2330
+ var previous = child.previousSibling;
2331
+ var next = child.nextSibling;
2332
+ if(previous){
2333
+ previous.nextSibling = next;
2334
+ }else{
2335
+ parentNode.firstChild = next
2336
+ }
2337
+ if(next){
2338
+ next.previousSibling = previous;
2339
+ }else{
2340
+ parentNode.lastChild = previous;
2341
+ }
2342
+ _onUpdateChild(parentNode.ownerDocument,parentNode);
2343
+ return child;
2344
+ }
2345
+ function _insertBefore(parentNode,newChild,nextChild){
2346
+ var cp = newChild.parentNode;
2347
+ if(cp){
2348
+ cp.removeChild(newChild);//remove and update
2349
+ }
2350
+ if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){
2351
+ var newFirst = newChild.firstChild;
2352
+ if (newFirst == null) {
2353
+ return newChild;
2354
+ }
2355
+ var newLast = newChild.lastChild;
2356
+ }else{
2357
+ newFirst = newLast = newChild;
2358
+ }
2359
+ var pre = nextChild ? nextChild.previousSibling : parentNode.lastChild;
2360
+
2361
+ newFirst.previousSibling = pre;
2362
+ newLast.nextSibling = nextChild;
2363
+
2364
+
2365
+ if(pre){
2366
+ pre.nextSibling = newFirst;
2367
+ }else{
2368
+ parentNode.firstChild = newFirst;
2369
+ }
2370
+ if(nextChild == null){
2371
+ parentNode.lastChild = newLast;
2372
+ }else{
2373
+ nextChild.previousSibling = newLast;
2374
+ }
2375
+ do{
2376
+ newFirst.parentNode = parentNode;
2377
+ }while(newFirst !== newLast && (newFirst= newFirst.nextSibling))
2378
+ _onUpdateChild(parentNode.ownerDocument||parentNode,parentNode);
2379
+ if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
2380
+ newChild.firstChild = newChild.lastChild = null;
2381
+ }
2382
+ return newChild;
2383
+ }
2384
+ function _appendSingleChild(parentNode,newChild){
2385
+ var cp = newChild.parentNode;
2386
+ if(cp){
2387
+ var pre = parentNode.lastChild;
2388
+ cp.removeChild(newChild);//remove and update
2389
+ var pre = parentNode.lastChild;
2390
+ }
2391
+ var pre = parentNode.lastChild;
2392
+ newChild.parentNode = parentNode;
2393
+ newChild.previousSibling = pre;
2394
+ newChild.nextSibling = null;
2395
+ if(pre){
2396
+ pre.nextSibling = newChild;
2397
+ }else{
2398
+ parentNode.firstChild = newChild;
2399
+ }
2400
+ parentNode.lastChild = newChild;
2401
+ _onUpdateChild(parentNode.ownerDocument,parentNode,newChild);
2402
+ return newChild;
2403
+ }
2404
+ Document.prototype = {
2405
+ nodeName : '#document',
2406
+ nodeType : DOCUMENT_NODE,
2407
+ doctype : null,
2408
+ documentElement : null,
2409
+ _inc : 1,
2410
+
2411
+ insertBefore : function(newChild, refChild){//raises
2412
+ if(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){
2413
+ var child = newChild.firstChild;
2414
+ while(child){
2415
+ var next = child.nextSibling;
2416
+ this.insertBefore(child,refChild);
2417
+ child = next;
2418
+ }
2419
+ return newChild;
2420
+ }
2421
+ if(this.documentElement == null && newChild.nodeType == 1){
2422
+ this.documentElement = newChild;
2423
+ }
2424
+
2425
+ return _insertBefore(this,newChild,refChild),(newChild.ownerDocument = this),newChild;
2426
+ },
2427
+ removeChild : function(oldChild){
2428
+ if(this.documentElement == oldChild){
2429
+ this.documentElement = null;
2430
+ }
2431
+ return _removeChild(this,oldChild);
2432
+ },
2433
+ importNode : function(importedNode,deep){
2434
+ return importNode(this,importedNode,deep);
2435
+ },
2436
+ getElementById : function(id){
2437
+ var rtv = null;
2438
+ _visitNode(this.documentElement,function(node){
2439
+ if(node.nodeType == 1){
2440
+ if(node.getAttribute('id') == id){
2441
+ rtv = node;
2442
+ return true;
2443
+ }
2444
+ }
2445
+ });
2446
+ return rtv;
2447
+ },
2448
+ createElement : function(tagName){
2449
+ var node = new Element();
2450
+ node.ownerDocument = this;
2451
+ node.nodeName = tagName;
2452
+ node.tagName = tagName;
2453
+ node.childNodes = new NodeList();
2454
+ var attrs = node.attributes = new NamedNodeMap();
2455
+ attrs._ownerElement = node;
2456
+ return node;
2457
+ },
2458
+ createDocumentFragment : function(){
2459
+ var node = new DocumentFragment();
2460
+ node.ownerDocument = this;
2461
+ node.childNodes = new NodeList();
2462
+ return node;
2463
+ },
2464
+ createTextNode : function(data){
2465
+ var node = new Text();
2466
+ node.ownerDocument = this;
2467
+ node.appendData(data);
2468
+ return node;
2469
+ },
2470
+ createComment : function(data){
2471
+ var node = new Comment();
2472
+ node.ownerDocument = this;
2473
+ node.appendData(data);
2474
+ return node;
2475
+ },
2476
+ createCDATASection : function(data){
2477
+ var node = new CDATASection();
2478
+ node.ownerDocument = this;
2479
+ node.appendData(data);
2480
+ return node;
2481
+ },
2482
+ createProcessingInstruction : function(target,data){
2483
+ var node = new ProcessingInstruction();
2484
+ node.ownerDocument = this;
2485
+ node.tagName = node.target = target;
2486
+ node.nodeValue= node.data = data;
2487
+ return node;
2488
+ },
2489
+ createAttribute : function(name){
2490
+ var node = new Attr();
2491
+ node.ownerDocument = this;
2492
+ node.name = name;
2493
+ node.nodeName = name;
2494
+ node.localName = name;
2495
+ node.specified = true;
2496
+ return node;
2497
+ },
2498
+ createEntityReference : function(name){
2499
+ var node = new EntityReference();
2500
+ node.ownerDocument = this;
2501
+ node.nodeName = name;
2502
+ return node;
2503
+ },
2504
+ createElementNS : function(namespaceURI,qualifiedName){
2505
+ var node = new Element();
2506
+ var pl = qualifiedName.split(':');
2507
+ var attrs = node.attributes = new NamedNodeMap();
2508
+ node.childNodes = new NodeList();
2509
+ node.ownerDocument = this;
2510
+ node.nodeName = qualifiedName;
2511
+ node.tagName = qualifiedName;
2512
+ node.namespaceURI = namespaceURI;
2513
+ if(pl.length == 2){
2514
+ node.prefix = pl[0];
2515
+ node.localName = pl[1];
2516
+ }else{
2517
+ node.localName = qualifiedName;
2518
+ }
2519
+ attrs._ownerElement = node;
2520
+ return node;
2521
+ },
2522
+ createAttributeNS : function(namespaceURI,qualifiedName){
2523
+ var node = new Attr();
2524
+ var pl = qualifiedName.split(':');
2525
+ node.ownerDocument = this;
2526
+ node.nodeName = qualifiedName;
2527
+ node.name = qualifiedName;
2528
+ node.namespaceURI = namespaceURI;
2529
+ node.specified = true;
2530
+ if(pl.length == 2){
2531
+ node.prefix = pl[0];
2532
+ node.localName = pl[1];
2533
+ }else{
2534
+ node.localName = qualifiedName;
2535
+ }
2536
+ return node;
2537
+ }
2538
+ };
2539
+ _extends(Document,Node);
2540
+
2541
+
2542
+ function Element() {
2543
+ this._nsMap = {};
2544
+ };
2545
+ Element.prototype = {
2546
+ nodeType : ELEMENT_NODE,
2547
+ hasAttribute : function(name){
2548
+ return this.getAttributeNode(name)!=null;
2549
+ },
2550
+ getAttribute : function(name){
2551
+ var attr = this.getAttributeNode(name);
2552
+ return attr && attr.value || '';
2553
+ },
2554
+ getAttributeNode : function(name){
2555
+ return this.attributes.getNamedItem(name);
2556
+ },
2557
+ setAttribute : function(name, value){
2558
+ var attr = this.ownerDocument.createAttribute(name);
2559
+ attr.value = attr.nodeValue = "" + value;
2560
+ this.setAttributeNode(attr);
2561
+ },
2562
+ removeAttribute : function(name){
2563
+ var attr = this.getAttributeNode(name);
2564
+ attr && this.removeAttributeNode(attr);
2565
+ },
2566
+ appendChild:function(newChild){
2567
+ if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){
2568
+ return this.insertBefore(newChild,null);
2569
+ }else{
2570
+ return _appendSingleChild(this,newChild);
2571
+ }
2572
+ },
2573
+ setAttributeNode : function(newAttr){
2574
+ return this.attributes.setNamedItem(newAttr);
2575
+ },
2576
+ setAttributeNodeNS : function(newAttr){
2577
+ return this.attributes.setNamedItemNS(newAttr);
2578
+ },
2579
+ removeAttributeNode : function(oldAttr){
2580
+ return this.attributes.removeNamedItem(oldAttr.nodeName);
2581
+ },
2582
+ removeAttributeNS : function(namespaceURI, localName){
2583
+ var old = this.getAttributeNodeNS(namespaceURI, localName);
2584
+ old && this.removeAttributeNode(old);
2585
+ },
2586
+
2587
+ hasAttributeNS : function(namespaceURI, localName){
2588
+ return this.getAttributeNodeNS(namespaceURI, localName)!=null;
2589
+ },
2590
+ getAttributeNS : function(namespaceURI, localName){
2591
+ var attr = this.getAttributeNodeNS(namespaceURI, localName);
2592
+ return attr && attr.value || '';
2593
+ },
2594
+ setAttributeNS : function(namespaceURI, qualifiedName, value){
2595
+ var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
2596
+ attr.value = attr.nodeValue = "" + value;
2597
+ this.setAttributeNode(attr);
2598
+ },
2599
+ getAttributeNodeNS : function(namespaceURI, localName){
2600
+ return this.attributes.getNamedItemNS(namespaceURI, localName);
2601
+ },
2602
+
2603
+ getElementsByTagName : function(tagName){
2604
+ return new LiveNodeList(this,function(base){
2605
+ var ls = [];
2606
+ _visitNode(base,function(node){
2607
+ if(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){
2608
+ ls.push(node);
2609
+ }
2610
+ });
2611
+ return ls;
2612
+ });
2613
+ },
2614
+ getElementsByTagNameNS : function(namespaceURI, localName){
2615
+ return new LiveNodeList(this,function(base){
2616
+ var ls = [];
2617
+ _visitNode(base,function(node){
2618
+ if(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){
2619
+ ls.push(node);
2620
+ }
2621
+ });
2622
+ return ls;
2623
+ });
2624
+ }
2625
+ };
2626
+ Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;
2627
+ Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;
2628
+
2629
+
2630
+ _extends(Element,Node);
2631
+ function Attr() {
2632
+ };
2633
+ Attr.prototype.nodeType = ATTRIBUTE_NODE;
2634
+ _extends(Attr,Node);
2635
+
2636
+
2637
+ function CharacterData() {
2638
+ };
2639
+ CharacterData.prototype = {
2640
+ data : '',
2641
+ substringData : function(offset, count) {
2642
+ return this.data.substring(offset, offset+count);
2643
+ },
2644
+ appendData: function(text) {
2645
+ text = this.data+text;
2646
+ this.nodeValue = this.data = text;
2647
+ this.length = text.length;
2648
+ },
2649
+ insertData: function(offset,text) {
2650
+ this.replaceData(offset,0,text);
2651
+ },
2652
+ appendChild:function(newChild){
2653
+ throw new Error(ExceptionMessage[3]);
2654
+ return Node.prototype.appendChild.apply(this,arguments);
2655
+ },
2656
+ deleteData: function(offset, count) {
2657
+ this.replaceData(offset,count,"");
2658
+ },
2659
+ replaceData: function(offset, count, text) {
2660
+ var start = this.data.substring(0,offset);
2661
+ var end = this.data.substring(offset+count);
2662
+ text = start + text + end;
2663
+ this.nodeValue = this.data = text;
2664
+ this.length = text.length;
2665
+ }
2666
+ }
2667
+ _extends(CharacterData,Node);
2668
+ function Text() {
2669
+ };
2670
+ Text.prototype = {
2671
+ nodeName : "#text",
2672
+ nodeType : TEXT_NODE,
2673
+ splitText : function(offset) {
2674
+ var text = this.data;
2675
+ var newText = text.substring(offset);
2676
+ text = text.substring(0, offset);
2677
+ this.data = this.nodeValue = text;
2678
+ this.length = text.length;
2679
+ var newNode = this.ownerDocument.createTextNode(newText);
2680
+ if(this.parentNode){
2681
+ this.parentNode.insertBefore(newNode, this.nextSibling);
2682
+ }
2683
+ return newNode;
2684
+ }
2685
+ }
2686
+ _extends(Text,CharacterData);
2687
+ function Comment() {
2688
+ };
2689
+ Comment.prototype = {
2690
+ nodeName : "#comment",
2691
+ nodeType : COMMENT_NODE
2692
+ }
2693
+ _extends(Comment,CharacterData);
2694
+
2695
+ function CDATASection() {
2696
+ };
2697
+ CDATASection.prototype = {
2698
+ nodeName : "#cdata-section",
2699
+ nodeType : CDATA_SECTION_NODE
2700
+ }
2701
+ _extends(CDATASection,CharacterData);
2702
+
2703
+
2704
+ function DocumentType() {
2705
+ }
2706
+ DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
2707
+ _extends(DocumentType,Node);
2708
+
2709
+ function Notation() {
2710
+ }
2711
+ Notation.prototype.nodeType = NOTATION_NODE;
2712
+ _extends(Notation,Node);
2713
+
2714
+ function Entity() {
2715
+ }
2716
+ Entity.prototype.nodeType = ENTITY_NODE;
2717
+ _extends(Entity,Node);
2718
+
2719
+ function EntityReference() {
2720
+ }
2721
+ EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
2722
+ _extends(EntityReference,Node);
2723
+
2724
+ function DocumentFragment() {
2725
+ }
2726
+ DocumentFragment.prototype.nodeName = "#document-fragment";
2727
+ DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
2728
+ _extends(DocumentFragment,Node);
2729
+
2730
+
2731
+ function ProcessingInstruction() {
2732
+ }
2733
+ ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
2734
+ _extends(ProcessingInstruction,Node);
2735
+ function XMLSerializer(){}
2736
+ XMLSerializer.prototype.serializeToString = function(node){
2737
+ var buf = [];
2738
+ serializeToString(node,buf);
2739
+ return buf.join('');
2740
+ }
2741
+ Node.prototype.toString =function(){
2742
+ return XMLSerializer.prototype.serializeToString(this);
2743
+ }
2744
+ function serializeToString(node,buf){
2745
+ switch(node.nodeType){
2746
+ case ELEMENT_NODE:
2747
+ var attrs = node.attributes;
2748
+ var len = attrs.length;
2749
+ var child = node.firstChild;
2750
+ var nodeName = node.tagName;
2751
+ var isHTML = htmlns === node.namespaceURI;
2752
+ buf.push('<',nodeName);
2753
+ for(var i=0;i<len;i++){
2754
+ serializeToString(attrs.item(i),buf);
2755
+ }
2756
+ if(child || isHTML && !/^(?:meta|link|img|br|hr|input|button)$/i.test(nodeName)){
2757
+ buf.push('>');
2758
+ if(isHTML && /^script$/i.test(nodeName)){
2759
+ if(child){
2760
+ buf.push(child.data);
2761
+ }
2762
+ }else{
2763
+ while(child){
2764
+ serializeToString(child,buf);
2765
+ child = child.nextSibling;
2766
+ }
2767
+ }
2768
+ buf.push('</',nodeName,'>');
2769
+ }else{
2770
+ buf.push('/>');
2771
+ }
2772
+ return;
2773
+ case DOCUMENT_NODE:
2774
+ case DOCUMENT_FRAGMENT_NODE:
2775
+ var child = node.firstChild;
2776
+ while(child){
2777
+ serializeToString(child,buf);
2778
+ child = child.nextSibling;
2779
+ }
2780
+ return;
2781
+ case ATTRIBUTE_NODE:
2782
+ return buf.push(' ',node.name,'="',node.value.replace(/[<&"]/g,_xmlEncoder),'"');
2783
+ case TEXT_NODE:
2784
+ return buf.push(node.data.replace(/[<&]/g,_xmlEncoder));
2785
+ case CDATA_SECTION_NODE:
2786
+ return buf.push( '<![CDATA[',node.data,']]>');
2787
+ case COMMENT_NODE:
2788
+ return buf.push( "<!--",node.data,"-->");
2789
+ case DOCUMENT_TYPE_NODE:
2790
+ var pubid = node.publicId;
2791
+ var sysid = node.systemId;
2792
+ buf.push('<!DOCTYPE ',node.name);
2793
+ if(pubid){
2794
+ buf.push(' PUBLIC "',pubid);
2795
+ if (sysid && sysid!='.') {
2796
+ buf.push( '" "',sysid);
2797
+ }
2798
+ buf.push('">');
2799
+ }else if(sysid && sysid!='.'){
2800
+ buf.push(' SYSTEM "',sysid,'">');
2801
+ }else{
2802
+ var sub = node.internalSubset;
2803
+ if(sub){
2804
+ buf.push(" [",sub,"]");
2805
+ }
2806
+ buf.push(">");
2807
+ }
2808
+ return;
2809
+ case PROCESSING_INSTRUCTION_NODE:
2810
+ return buf.push( "<?",node.target," ",node.data,"?>");
2811
+ case ENTITY_REFERENCE_NODE:
2812
+ return buf.push( '&',node.nodeName,';');
2813
+ default:
2814
+ buf.push('??',node.nodeName);
2815
+ }
2816
+ }
2817
+ function importNode(doc,node,deep){
2818
+ var node2;
2819
+ switch (node.nodeType) {
2820
+ case ELEMENT_NODE:
2821
+ node2 = node.cloneNode(false);
2822
+ node2.ownerDocument = doc;
2823
+ case DOCUMENT_FRAGMENT_NODE:
2824
+ break;
2825
+ case ATTRIBUTE_NODE:
2826
+ deep = true;
2827
+ break;
2828
+ }
2829
+ if(!node2){
2830
+ node2 = node.cloneNode(false);//false
2831
+ }
2832
+ node2.ownerDocument = doc;
2833
+ node2.parentNode = null;
2834
+ if(deep){
2835
+ var child = node.firstChild;
2836
+ while(child){
2837
+ node2.appendChild(importNode(doc,child,deep));
2838
+ child = child.nextSibling;
2839
+ }
2840
+ }
2841
+ return node2;
2842
+ }
2843
+ function cloneNode(doc,node,deep){
2844
+ var node2 = new node.constructor();
2845
+ for(var n in node){
2846
+ var v = node[n];
2847
+ if(typeof v != 'object' ){
2848
+ if(v != node2[n]){
2849
+ node2[n] = v;
2850
+ }
2851
+ }
2852
+ }
2853
+ if(node.childNodes){
2854
+ node2.childNodes = new NodeList();
2855
+ }
2856
+ node2.ownerDocument = doc;
2857
+ switch (node2.nodeType) {
2858
+ case ELEMENT_NODE:
2859
+ var attrs = node.attributes;
2860
+ var attrs2 = node2.attributes = new NamedNodeMap();
2861
+ var len = attrs.length;
2862
+ attrs2._ownerElement = node2;
2863
+ for(var i=0;i<len;i++){
2864
+ node2.setAttributeNode(cloneNode(doc,attrs.item(i),true));
2865
+ }
2866
+ break;
2867
+ case ATTRIBUTE_NODE:
2868
+ deep = true;
2869
+ }
2870
+ if(deep){
2871
+ var child = node.firstChild;
2872
+ while(child){
2873
+ node2.appendChild(cloneNode(doc,child,deep));
2874
+ child = child.nextSibling;
2875
+ }
2876
+ }
2877
+ return node2;
2878
+ }
2879
+
2880
+ function __set__(object,key,value){
2881
+ object[key] = value;
2882
+ }
2883
+ function getTextContent(node){
2884
+ switch(node.nodeType){
2885
+ case 1:
2886
+ case 11:
2887
+ var buf = [];
2888
+ node = node.firstChild;
2889
+ while(node){
2890
+ if(node.nodeType!==7 && node.nodeType !==8){
2891
+ buf.push(getTextContent(node));
2892
+ }
2893
+ node = node.nextSibling;
2894
+ }
2895
+ return buf.join('');
2896
+ default:
2897
+ return node.nodeValue;
2898
+ }
2899
+ }
2900
+ try{
2901
+ if(Object.defineProperty){
2902
+ Object.defineProperty(LiveNodeList.prototype,'length',{
2903
+ get:function(){
2904
+ _updateLiveList(this);
2905
+ return this.$$length;
2906
+ }
2907
+ });
2908
+ Object.defineProperty(Node.prototype,'textContent',{
2909
+ get:function(){
2910
+ return getTextContent(this);
2911
+ },
2912
+ set:function(data){
2913
+ switch(this.nodeType){
2914
+ case 1:
2915
+ case 11:
2916
+ while(this.firstChild){
2917
+ this.removeChild(this.firstChild);
2918
+ }
2919
+ if(data || String(data)){
2920
+ this.appendChild(this.ownerDocument.createTextNode(data));
2921
+ }
2922
+ break;
2923
+ default:
2924
+ this.data = data;
2925
+ this.value = value;
2926
+ this.nodeValue = data;
2927
+ }
2928
+ }
2929
+ });
2930
+
2931
+ __set__ = function(object,key,value){
2932
+ object['$$'+key] = value;
2933
+ };
2934
+ }
2935
+ }catch(e){//ie8
2936
+ }
2937
+
2938
+ return DOMImplementation;
2939
+ });
2940
+
2941
+ ace.define("ace/mode/xml/dom-parser",[], function(require, exports, module) {
2942
+ 'use strict';
2943
+
2944
+ var XMLReader = require('./sax'),
2945
+ DOMImplementation = require('./dom');
2946
+
2947
+ function DOMParser(options){
2948
+ this.options = options ||{locator:{}};
2949
+
2950
+ }
2951
+ DOMParser.prototype.parseFromString = function(source,mimeType){
2952
+ var options = this.options;
2953
+ var sax = new XMLReader();
2954
+ var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler
2955
+ var errorHandler = options.errorHandler;
2956
+ var locator = options.locator;
2957
+ var defaultNSMap = options.xmlns||{};
2958
+ var entityMap = {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"}
2959
+ if(locator){
2960
+ domBuilder.setDocumentLocator(locator)
2961
+ }
2962
+
2963
+ sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator);
2964
+ sax.domBuilder = options.domBuilder || domBuilder;
2965
+ if(/\/x?html?$/.test(mimeType)){
2966
+ entityMap.nbsp = '\xa0';
2967
+ entityMap.copy = '\xa9';
2968
+ defaultNSMap['']= 'http://www.w3.org/1999/xhtml';
2969
+ }
2970
+ if(source){
2971
+ sax.parse(source,defaultNSMap,entityMap);
2972
+ }else{
2973
+ sax.errorHandler.error("invalid document source");
2974
+ }
2975
+ return domBuilder.document;
2976
+ }
2977
+ function buildErrorHandler(errorImpl,domBuilder,locator){
2978
+ if(!errorImpl){
2979
+ if(domBuilder instanceof DOMHandler){
2980
+ return domBuilder;
2981
+ }
2982
+ errorImpl = domBuilder ;
2983
+ }
2984
+ var errorHandler = {}
2985
+ var isCallback = errorImpl instanceof Function;
2986
+ locator = locator||{}
2987
+ function build(key){
2988
+ var fn = errorImpl[key];
2989
+ if(!fn){
2990
+ if(isCallback){
2991
+ fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl;
2992
+ }else{
2993
+ var i=arguments.length;
2994
+ while(--i){
2995
+ if(fn = errorImpl[arguments[i]]){
2996
+ break;
2997
+ }
2998
+ }
2999
+ }
3000
+ }
3001
+ errorHandler[key] = fn && function(msg){
3002
+ fn(msg+_locator(locator), msg, locator);
3003
+ }||function(){};
3004
+ }
3005
+ build('warning','warn');
3006
+ build('error','warn','warning');
3007
+ build('fatalError','warn','warning','error');
3008
+ return errorHandler;
3009
+ }
3010
+ function DOMHandler() {
3011
+ this.cdata = false;
3012
+ }
3013
+ function position(locator,node){
3014
+ node.lineNumber = locator.lineNumber;
3015
+ node.columnNumber = locator.columnNumber;
3016
+ }
3017
+ DOMHandler.prototype = {
3018
+ startDocument : function() {
3019
+ this.document = new DOMImplementation().createDocument(null, null, null);
3020
+ if (this.locator) {
3021
+ this.document.documentURI = this.locator.systemId;
3022
+ }
3023
+ },
3024
+ startElement:function(namespaceURI, localName, qName, attrs) {
3025
+ var doc = this.document;
3026
+ var el = doc.createElementNS(namespaceURI, qName||localName);
3027
+ var len = attrs.length;
3028
+ appendElement(this, el);
3029
+ this.currentElement = el;
3030
+
3031
+ this.locator && position(this.locator,el)
3032
+ for (var i = 0 ; i < len; i++) {
3033
+ var namespaceURI = attrs.getURI(i);
3034
+ var value = attrs.getValue(i);
3035
+ var qName = attrs.getQName(i);
3036
+ var attr = doc.createAttributeNS(namespaceURI, qName);
3037
+ if( attr.getOffset){
3038
+ position(attr.getOffset(1),attr)
3039
+ }
3040
+ attr.value = attr.nodeValue = value;
3041
+ el.setAttributeNode(attr)
3042
+ }
3043
+ },
3044
+ endElement:function(namespaceURI, localName, qName) {
3045
+ var current = this.currentElement
3046
+ var tagName = current.tagName;
3047
+ this.currentElement = current.parentNode;
3048
+ },
3049
+ startPrefixMapping:function(prefix, uri) {
3050
+ },
3051
+ endPrefixMapping:function(prefix) {
3052
+ },
3053
+ processingInstruction:function(target, data) {
3054
+ var ins = this.document.createProcessingInstruction(target, data);
3055
+ this.locator && position(this.locator,ins)
3056
+ appendElement(this, ins);
3057
+ },
3058
+ ignorableWhitespace:function(ch, start, length) {
3059
+ },
3060
+ characters:function(chars, start, length) {
3061
+ chars = _toString.apply(this,arguments)
3062
+ if(this.currentElement && chars){
3063
+ if (this.cdata) {
3064
+ var charNode = this.document.createCDATASection(chars);
3065
+ this.currentElement.appendChild(charNode);
3066
+ } else {
3067
+ var charNode = this.document.createTextNode(chars);
3068
+ this.currentElement.appendChild(charNode);
3069
+ }
3070
+ this.locator && position(this.locator,charNode)
3071
+ }
3072
+ },
3073
+ skippedEntity:function(name) {
3074
+ },
3075
+ endDocument:function() {
3076
+ this.document.normalize();
3077
+ },
3078
+ setDocumentLocator:function (locator) {
3079
+ if(this.locator = locator){// && !('lineNumber' in locator)){
3080
+ locator.lineNumber = 0;
3081
+ }
3082
+ },
3083
+ comment:function(chars, start, length) {
3084
+ chars = _toString.apply(this,arguments)
3085
+ var comm = this.document.createComment(chars);
3086
+ this.locator && position(this.locator,comm)
3087
+ appendElement(this, comm);
3088
+ },
3089
+
3090
+ startCDATA:function() {
3091
+ this.cdata = true;
3092
+ },
3093
+ endCDATA:function() {
3094
+ this.cdata = false;
3095
+ },
3096
+
3097
+ startDTD:function(name, publicId, systemId) {
3098
+ var impl = this.document.implementation;
3099
+ if (impl && impl.createDocumentType) {
3100
+ var dt = impl.createDocumentType(name, publicId, systemId);
3101
+ this.locator && position(this.locator,dt)
3102
+ appendElement(this, dt);
3103
+ }
3104
+ },
3105
+ warning:function(error) {
3106
+ console.warn(error,_locator(this.locator));
3107
+ },
3108
+ error:function(error) {
3109
+ console.error(error,_locator(this.locator));
3110
+ },
3111
+ fatalError:function(error) {
3112
+ console.error(error,_locator(this.locator));
3113
+ throw error;
3114
+ }
3115
+ }
3116
+ function _locator(l){
3117
+ if(l){
3118
+ return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']'
3119
+ }
3120
+ }
3121
+ function _toString(chars,start,length){
3122
+ if(typeof chars == 'string'){
3123
+ return chars.substr(start,length)
3124
+ }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)")
3125
+ if(chars.length >= start+length || start){
3126
+ return new java.lang.String(chars,start,length)+'';
3127
+ }
3128
+ return chars;
3129
+ }
3130
+ }
3131
+ "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){
3132
+ DOMHandler.prototype[key] = function(){return null}
3133
+ })
3134
+ function appendElement (hander,node) {
3135
+ if (!hander.currentElement) {
3136
+ hander.document.appendChild(node);
3137
+ } else {
3138
+ hander.currentElement.appendChild(node);
3139
+ }
3140
+ }//appendChild and setAttributeNS are preformance key
3141
+
3142
+ return {
3143
+ DOMParser: DOMParser
3144
+ };
3145
+ });
3146
+
3147
+ ace.define("ace/mode/xml_worker",[], function(require, exports, module) {
3148
+ "use strict";
3149
+
3150
+ var oop = require("../lib/oop");
3151
+ var lang = require("../lib/lang");
3152
+ var Mirror = require("../worker/mirror").Mirror;
3153
+ var DOMParser = require("./xml/dom-parser").DOMParser;
3154
+
3155
+ var Worker = exports.Worker = function(sender) {
3156
+ Mirror.call(this, sender);
3157
+ this.setTimeout(400);
3158
+ this.context = null;
3159
+ };
3160
+
3161
+ oop.inherits(Worker, Mirror);
3162
+
3163
+ (function() {
3164
+
3165
+ this.setOptions = function(options) {
3166
+ this.context = options.context;
3167
+ };
3168
+
3169
+ this.onUpdate = function() {
3170
+ var value = this.doc.getValue();
3171
+ if (!value)
3172
+ return;
3173
+ var parser = new DOMParser();
3174
+ var errors = [];
3175
+ parser.options.errorHandler = {
3176
+ fatalError: function(fullMsg, errorMsg, locator) {
3177
+ errors.push({
3178
+ row: locator.lineNumber,
3179
+ column: locator.columnNumber,
3180
+ text: errorMsg,
3181
+ type: "error"
3182
+ });
3183
+ },
3184
+ error: function(fullMsg, errorMsg, locator) {
3185
+ errors.push({
3186
+ row: locator.lineNumber,
3187
+ column: locator.columnNumber,
3188
+ text: errorMsg,
3189
+ type: "error"
3190
+ });
3191
+ },
3192
+ warning: function(fullMsg, errorMsg, locator) {
3193
+ errors.push({
3194
+ row: locator.lineNumber,
3195
+ column: locator.columnNumber,
3196
+ text: errorMsg,
3197
+ type: "warning"
3198
+ });
3199
+ }
3200
+ };
3201
+
3202
+ parser.parseFromString(value);
3203
+ this.sender.emit("error", errors);
3204
+ };
3205
+
3206
+ }).call(Worker.prototype);
3207
+
3208
+ });