ace-rails-ap 4.3 → 4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/ace-rails-ap.gemspec +0 -2
  4. data/lib/ace/rails/version.rb +1 -1
  5. data/vendor/assets/javascripts/ace/ace.js +659 -1137
  6. data/vendor/assets/javascripts/ace/ext-beautify.js +5 -2
  7. data/vendor/assets/javascripts/ace/ext-code_lens.js +238 -0
  8. data/vendor/assets/javascripts/ace/ext-emmet.js +36 -28
  9. data/vendor/assets/javascripts/ace/ext-language_tools.js +63 -48
  10. data/vendor/assets/javascripts/ace/ext-modelist.js +12 -6
  11. data/vendor/assets/javascripts/ace/ext-options.js +46 -19
  12. data/vendor/assets/javascripts/ace/ext-prompt.js +57 -38
  13. data/vendor/assets/javascripts/ace/ext-settings_menu.js +46 -19
  14. data/vendor/assets/javascripts/ace/ext-spellcheck.js +0 -1
  15. data/vendor/assets/javascripts/ace/ext-themelist.js +2 -1
  16. data/vendor/assets/javascripts/ace/keybinding-emacs.js +21 -22
  17. data/vendor/assets/javascripts/ace/keybinding-sublime.js +2 -5
  18. data/vendor/assets/javascripts/ace/keybinding-vim.js +45 -9
  19. data/vendor/assets/javascripts/ace/keybinding-vscode.js +262 -0
  20. data/vendor/assets/javascripts/ace/mode-abc.js +3 -0
  21. data/vendor/assets/javascripts/ace/mode-actionscript.js +1 -0
  22. data/vendor/assets/javascripts/ace/mode-alda.js +311 -0
  23. data/vendor/assets/javascripts/ace/mode-asl.js +17 -16
  24. data/vendor/assets/javascripts/ace/mode-c_cpp.js +1 -0
  25. data/vendor/assets/javascripts/ace/mode-clojure.js +1 -0
  26. data/vendor/assets/javascripts/ace/mode-coffee.js +1 -0
  27. data/vendor/assets/javascripts/ace/mode-coldfusion.js +3 -0
  28. data/vendor/assets/javascripts/ace/mode-csound_document.js +40 -5
  29. data/vendor/assets/javascripts/ace/mode-csound_orchestra.js +37 -5
  30. data/vendor/assets/javascripts/ace/mode-csound_score.js +1 -0
  31. data/vendor/assets/javascripts/ace/mode-css.js +1 -0
  32. data/vendor/assets/javascripts/ace/mode-curly.js +3 -0
  33. data/vendor/assets/javascripts/ace/mode-d.js +1 -1
  34. data/vendor/assets/javascripts/ace/mode-dart.js +2 -0
  35. data/vendor/assets/javascripts/ace/mode-diff.js +1 -0
  36. data/vendor/assets/javascripts/ace/mode-django.js +4 -0
  37. data/vendor/assets/javascripts/ace/mode-dockerfile.js +1 -0
  38. data/vendor/assets/javascripts/ace/mode-drools.js +1 -0
  39. data/vendor/assets/javascripts/ace/mode-edifact.js +1 -0
  40. data/vendor/assets/javascripts/ace/mode-ejs.js +673 -165
  41. data/vendor/assets/javascripts/ace/mode-erlang.js +1 -0
  42. data/vendor/assets/javascripts/ace/mode-fsl.js +1 -0
  43. data/vendor/assets/javascripts/ace/mode-glsl.js +1 -0
  44. data/vendor/assets/javascripts/ace/mode-gobstones.js +2 -0
  45. data/vendor/assets/javascripts/ace/mode-graphqlschema.js +1 -0
  46. data/vendor/assets/javascripts/ace/mode-groovy.js +1 -0
  47. data/vendor/assets/javascripts/ace/mode-haml.js +419 -104
  48. data/vendor/assets/javascripts/ace/mode-handlebars.js +3 -0
  49. data/vendor/assets/javascripts/ace/mode-haskell.js +1 -0
  50. data/vendor/assets/javascripts/ace/mode-html.js +3 -0
  51. data/vendor/assets/javascripts/ace/mode-html_elixir.js +3 -0
  52. data/vendor/assets/javascripts/ace/mode-html_ruby.js +673 -165
  53. data/vendor/assets/javascripts/ace/mode-io.js +1 -0
  54. data/vendor/assets/javascripts/ace/mode-java.js +2 -0
  55. data/vendor/assets/javascripts/ace/mode-javascript.js +1 -0
  56. data/vendor/assets/javascripts/ace/mode-json.js +3 -0
  57. data/vendor/assets/javascripts/ace/mode-json5.js +360 -0
  58. data/vendor/assets/javascripts/ace/mode-jsoniq.js +1 -0
  59. data/vendor/assets/javascripts/ace/mode-jsp.js +1 -0
  60. data/vendor/assets/javascripts/ace/mode-kotlin.js +2 -0
  61. data/vendor/assets/javascripts/ace/mode-liquid.js +4 -0
  62. data/vendor/assets/javascripts/ace/mode-lsl.js +1 -0
  63. data/vendor/assets/javascripts/ace/mode-lua.js +1 -0
  64. data/vendor/assets/javascripts/ace/mode-luapage.js +4 -0
  65. data/vendor/assets/javascripts/ace/mode-makefile.js +1 -0
  66. data/vendor/assets/javascripts/ace/mode-markdown.js +5 -0
  67. data/vendor/assets/javascripts/ace/mode-maze.js +1 -0
  68. data/vendor/assets/javascripts/ace/mode-mediawiki.js +592 -0
  69. data/vendor/assets/javascripts/ace/mode-nix.js +1 -0
  70. data/vendor/assets/javascripts/ace/mode-nsis.js +1 -1
  71. data/vendor/assets/javascripts/ace/mode-nunjucks.js +2698 -0
  72. data/vendor/assets/javascripts/ace/mode-perl.js +1 -0
  73. data/vendor/assets/javascripts/ace/mode-pgsql.js +2 -2
  74. data/vendor/assets/javascripts/ace/mode-php.js +4 -0
  75. data/vendor/assets/javascripts/ace/mode-php_laravel_blade.js +4 -0
  76. data/vendor/assets/javascripts/ace/mode-prisma.js +489 -0
  77. data/vendor/assets/javascripts/ace/mode-protobuf.js +1 -0
  78. data/vendor/assets/javascripts/ace/mode-puppet.js +5 -6
  79. data/vendor/assets/javascripts/ace/mode-python.js +3 -2
  80. data/vendor/assets/javascripts/ace/mode-qml.js +381 -0
  81. data/vendor/assets/javascripts/ace/mode-r.js +1 -0
  82. data/vendor/assets/javascripts/ace/mode-razor.js +4 -0
  83. data/vendor/assets/javascripts/ace/mode-rhtml.js +3 -0
  84. data/vendor/assets/javascripts/ace/mode-rst.js +1 -0
  85. data/vendor/assets/javascripts/ace/mode-ruby.js +670 -165
  86. data/vendor/assets/javascripts/ace/mode-rust.js +1 -1
  87. data/vendor/assets/javascripts/ace/mode-scala.js +1 -0
  88. data/vendor/assets/javascripts/ace/mode-sh.js +1 -0
  89. data/vendor/assets/javascripts/ace/mode-sjs.js +1 -0
  90. data/vendor/assets/javascripts/ace/mode-slim.js +708 -110
  91. data/vendor/assets/javascripts/ace/mode-smarty.js +3 -0
  92. data/vendor/assets/javascripts/ace/mode-snippets.js +1 -0
  93. data/vendor/assets/javascripts/ace/mode-soy_template.js +3 -0
  94. data/vendor/assets/javascripts/ace/mode-sql.js +1 -0
  95. data/vendor/assets/javascripts/ace/mode-sqlserver.js +2 -1
  96. data/vendor/assets/javascripts/ace/mode-svg.js +1 -0
  97. data/vendor/assets/javascripts/ace/mode-swift.js +6 -0
  98. data/vendor/assets/javascripts/ace/mode-tcl.js +1 -0
  99. data/vendor/assets/javascripts/ace/mode-terraform.js +10 -7
  100. data/vendor/assets/javascripts/ace/mode-tex.js +1 -0
  101. data/vendor/assets/javascripts/ace/mode-textile.js +1 -0
  102. data/vendor/assets/javascripts/ace/mode-tsx.js +1 -0
  103. data/vendor/assets/javascripts/ace/mode-twig.js +3 -0
  104. data/vendor/assets/javascripts/ace/mode-typescript.js +1 -0
  105. data/vendor/assets/javascripts/ace/mode-vala.js +1 -0
  106. data/vendor/assets/javascripts/ace/mode-vbscript.js +444 -15
  107. data/vendor/assets/javascripts/ace/mode-velocity.js +4 -0
  108. data/vendor/assets/javascripts/ace/mode-vhdl.js +5 -6
  109. data/vendor/assets/javascripts/ace/mode-visualforce.js +3 -0
  110. data/vendor/assets/javascripts/ace/mode-wollok.js +2 -0
  111. data/vendor/assets/javascripts/ace/mode-xquery.js +1 -0
  112. data/vendor/assets/javascripts/ace/snippets/abap.js +1 -6
  113. data/vendor/assets/javascripts/ace/snippets/ada.js +1 -6
  114. data/vendor/assets/javascripts/ace/snippets/alda.js +9 -0
  115. data/vendor/assets/javascripts/ace/snippets/apache_conf.js +1 -6
  116. data/vendor/assets/javascripts/ace/snippets/apex.js +1 -6
  117. data/vendor/assets/javascripts/ace/snippets/applescript.js +1 -6
  118. data/vendor/assets/javascripts/ace/snippets/aql.js +1 -6
  119. data/vendor/assets/javascripts/ace/snippets/asciidoc.js +1 -6
  120. data/vendor/assets/javascripts/ace/snippets/asl.js +1 -5
  121. data/vendor/assets/javascripts/ace/snippets/assembly_x86.js +1 -6
  122. data/vendor/assets/javascripts/ace/snippets/autohotkey.js +1 -6
  123. data/vendor/assets/javascripts/ace/snippets/batchfile.js +1 -6
  124. data/vendor/assets/javascripts/ace/snippets/c9search.js +1 -6
  125. data/vendor/assets/javascripts/ace/snippets/cirru.js +1 -6
  126. data/vendor/assets/javascripts/ace/snippets/cobol.js +1 -6
  127. data/vendor/assets/javascripts/ace/snippets/coldfusion.js +1 -6
  128. data/vendor/assets/javascripts/ace/snippets/crystal.js +1 -6
  129. data/vendor/assets/javascripts/ace/snippets/csharp.js +1 -6
  130. data/vendor/assets/javascripts/ace/snippets/csound_score.js +1 -6
  131. data/vendor/assets/javascripts/ace/snippets/csp.js +1 -6
  132. data/vendor/assets/javascripts/ace/snippets/curly.js +1 -6
  133. data/vendor/assets/javascripts/ace/snippets/d.js +1 -6
  134. data/vendor/assets/javascripts/ace/snippets/dockerfile.js +1 -6
  135. data/vendor/assets/javascripts/ace/snippets/dot.js +1 -6
  136. data/vendor/assets/javascripts/ace/snippets/eiffel.js +1 -6
  137. data/vendor/assets/javascripts/ace/snippets/ejs.js +1 -6
  138. data/vendor/assets/javascripts/ace/snippets/elixir.js +1 -6
  139. data/vendor/assets/javascripts/ace/snippets/elm.js +1 -6
  140. data/vendor/assets/javascripts/ace/snippets/forth.js +1 -6
  141. data/vendor/assets/javascripts/ace/snippets/fortran.js +1 -6
  142. data/vendor/assets/javascripts/ace/snippets/fsharp.js +1 -6
  143. data/vendor/assets/javascripts/ace/snippets/ftl.js +1 -6
  144. data/vendor/assets/javascripts/ace/snippets/gcode.js +1 -6
  145. data/vendor/assets/javascripts/ace/snippets/gherkin.js +1 -6
  146. data/vendor/assets/javascripts/ace/snippets/gitignore.js +1 -6
  147. data/vendor/assets/javascripts/ace/snippets/glsl.js +1 -6
  148. data/vendor/assets/javascripts/ace/snippets/golang.js +1 -6
  149. data/vendor/assets/javascripts/ace/snippets/groovy.js +1 -6
  150. data/vendor/assets/javascripts/ace/snippets/handlebars.js +1 -6
  151. data/vendor/assets/javascripts/ace/snippets/haskell_cabal.js +1 -6
  152. data/vendor/assets/javascripts/ace/snippets/haxe.js +1 -6
  153. data/vendor/assets/javascripts/ace/snippets/hjson.js +1 -6
  154. data/vendor/assets/javascripts/ace/snippets/html_elixir.js +1 -6
  155. data/vendor/assets/javascripts/ace/snippets/html_ruby.js +1 -6
  156. data/vendor/assets/javascripts/ace/snippets/ini.js +1 -6
  157. data/vendor/assets/javascripts/ace/snippets/jack.js +1 -6
  158. data/vendor/assets/javascripts/ace/snippets/jade.js +1 -6
  159. data/vendor/assets/javascripts/ace/snippets/json.js +1 -6
  160. data/vendor/assets/javascripts/ace/snippets/json5.js +9 -0
  161. data/vendor/assets/javascripts/ace/snippets/jssm.js +1 -6
  162. data/vendor/assets/javascripts/ace/snippets/jsx.js +1 -6
  163. data/vendor/assets/javascripts/ace/snippets/julia.js +1 -6
  164. data/vendor/assets/javascripts/ace/snippets/kotlin.js +1 -6
  165. data/vendor/assets/javascripts/ace/snippets/latex.js +1 -6
  166. data/vendor/assets/javascripts/ace/snippets/less.js +1 -6
  167. data/vendor/assets/javascripts/ace/snippets/lisp.js +1 -6
  168. data/vendor/assets/javascripts/ace/snippets/livescript.js +1 -6
  169. data/vendor/assets/javascripts/ace/snippets/logiql.js +1 -6
  170. data/vendor/assets/javascripts/ace/snippets/logtalk.js +1 -6
  171. data/vendor/assets/javascripts/ace/snippets/luapage.js +1 -6
  172. data/vendor/assets/javascripts/ace/snippets/lucene.js +1 -6
  173. data/vendor/assets/javascripts/ace/snippets/mask.js +1 -6
  174. data/vendor/assets/javascripts/ace/snippets/matlab.js +1 -6
  175. data/vendor/assets/javascripts/ace/snippets/mediawiki.js +9 -0
  176. data/vendor/assets/javascripts/ace/snippets/mel.js +1 -6
  177. data/vendor/assets/javascripts/ace/snippets/mixal.js +1 -6
  178. data/vendor/assets/javascripts/ace/snippets/mushcode.js +1 -6
  179. data/vendor/assets/javascripts/ace/snippets/mysql.js +1 -6
  180. data/vendor/assets/javascripts/ace/snippets/nginx.js +1 -6
  181. data/vendor/assets/javascripts/ace/snippets/nim.js +1 -6
  182. data/vendor/assets/javascripts/ace/snippets/nix.js +1 -6
  183. data/vendor/assets/javascripts/ace/snippets/nsis.js +1 -6
  184. data/vendor/assets/javascripts/ace/snippets/nunjucks.js +9 -0
  185. data/vendor/assets/javascripts/ace/snippets/objectivec.js +1 -6
  186. data/vendor/assets/javascripts/ace/snippets/ocaml.js +1 -6
  187. data/vendor/assets/javascripts/ace/snippets/pascal.js +1 -6
  188. data/vendor/assets/javascripts/ace/snippets/perl6.js +1 -6
  189. data/vendor/assets/javascripts/ace/snippets/pgsql.js +1 -6
  190. data/vendor/assets/javascripts/ace/snippets/php_laravel_blade.js +1 -6
  191. data/vendor/assets/javascripts/ace/snippets/pig.js +1 -6
  192. data/vendor/assets/javascripts/ace/snippets/plain_text.js +1 -6
  193. data/vendor/assets/javascripts/ace/snippets/powershell.js +1 -6
  194. data/vendor/assets/javascripts/ace/snippets/praat.js +1 -6
  195. data/vendor/assets/javascripts/ace/snippets/prisma.js +9 -0
  196. data/vendor/assets/javascripts/ace/snippets/prolog.js +1 -6
  197. data/vendor/assets/javascripts/ace/snippets/properties.js +1 -6
  198. data/vendor/assets/javascripts/ace/snippets/protobuf.js +1 -6
  199. data/vendor/assets/javascripts/ace/snippets/puppet.js +1 -6
  200. data/vendor/assets/javascripts/ace/snippets/qml.js +9 -0
  201. data/vendor/assets/javascripts/ace/snippets/rdoc.js +1 -6
  202. data/vendor/assets/javascripts/ace/snippets/red.js +1 -6
  203. data/vendor/assets/javascripts/ace/snippets/redshift.js +1 -6
  204. data/vendor/assets/javascripts/ace/snippets/rhtml.js +1 -6
  205. data/vendor/assets/javascripts/ace/snippets/rust.js +1 -6
  206. data/vendor/assets/javascripts/ace/snippets/sass.js +1 -6
  207. data/vendor/assets/javascripts/ace/snippets/scad.js +1 -6
  208. data/vendor/assets/javascripts/ace/snippets/scala.js +1 -6
  209. data/vendor/assets/javascripts/ace/snippets/scheme.js +1 -6
  210. data/vendor/assets/javascripts/ace/snippets/scss.js +1 -6
  211. data/vendor/assets/javascripts/ace/snippets/sjs.js +1 -6
  212. data/vendor/assets/javascripts/ace/snippets/slim.js +1 -6
  213. data/vendor/assets/javascripts/ace/snippets/smarty.js +1 -6
  214. data/vendor/assets/javascripts/ace/snippets/soy_template.js +1 -6
  215. data/vendor/assets/javascripts/ace/snippets/space.js +1 -6
  216. data/vendor/assets/javascripts/ace/snippets/sparql.js +1 -6
  217. data/vendor/assets/javascripts/ace/snippets/stylus.js +1 -6
  218. data/vendor/assets/javascripts/ace/snippets/svg.js +1 -6
  219. data/vendor/assets/javascripts/ace/snippets/swift.js +1 -6
  220. data/vendor/assets/javascripts/ace/snippets/terraform.js +1 -6
  221. data/vendor/assets/javascripts/ace/snippets/text.js +1 -6
  222. data/vendor/assets/javascripts/ace/snippets/toml.js +1 -6
  223. data/vendor/assets/javascripts/ace/snippets/tsx.js +1 -6
  224. data/vendor/assets/javascripts/ace/snippets/turtle.js +1 -6
  225. data/vendor/assets/javascripts/ace/snippets/twig.js +1 -6
  226. data/vendor/assets/javascripts/ace/snippets/typescript.js +1 -6
  227. data/vendor/assets/javascripts/ace/snippets/vbscript.js +1 -6
  228. data/vendor/assets/javascripts/ace/snippets/verilog.js +1 -6
  229. data/vendor/assets/javascripts/ace/snippets/vhdl.js +1 -6
  230. data/vendor/assets/javascripts/ace/snippets/visualforce.js +1 -6
  231. data/vendor/assets/javascripts/ace/snippets/xml.js +1 -6
  232. data/vendor/assets/javascripts/ace/snippets/yaml.js +1 -6
  233. data/vendor/assets/javascripts/ace/snippets/zeek.js +1 -6
  234. data/vendor/assets/javascripts/ace/theme-ambiance.js +3 -2
  235. data/vendor/assets/javascripts/ace/theme-chaos.js +1 -1
  236. data/vendor/assets/javascripts/ace/theme-nord_dark.js +102 -0
  237. data/vendor/assets/javascripts/ace/worker-base.js +1421 -0
  238. data/vendor/assets/javascripts/ace/worker-coffee.js +17 -703
  239. data/vendor/assets/javascripts/ace/worker-css.js +17 -703
  240. data/vendor/assets/javascripts/ace/worker-html.js +17 -703
  241. data/vendor/assets/javascripts/ace/worker-javascript.js +7833 -5352
  242. data/vendor/assets/javascripts/ace/worker-json.js +17 -703
  243. data/vendor/assets/javascripts/ace/worker-lua.js +17 -703
  244. data/vendor/assets/javascripts/ace/worker-php.js +857 -1475
  245. data/vendor/assets/javascripts/ace/worker-xml.js +26 -707
  246. data/vendor/assets/javascripts/ace/worker-xquery.js +17 -703
  247. metadata +18 -4
  248. data/vendor/assets/javascripts/ace/mode-bro.js +0 -334
  249. data/vendor/assets/javascripts/ace/snippets/bro.js +0 -14
@@ -209,7 +209,6 @@ window.onmessage = function(e) {
209
209
  }
210
210
  else if (msg.init) {
211
211
  window.initBaseUrls(msg.tlns);
212
- require("ace/lib/es5-shim");
213
212
  sender = window.sender = window.initSender();
214
213
  var clazz = require(msg.module)[msg.classname];
215
214
  main = window.main = new clazz(sender);
@@ -599,8 +598,8 @@ EventEmitter._signal = function(eventName, e) {
599
598
 
600
599
  EventEmitter.once = function(eventName, callback) {
601
600
  var _self = this;
602
- this.addEventListener(eventName, function newCallback() {
603
- _self.removeEventListener(eventName, newCallback);
601
+ this.on(eventName, function newCallback() {
602
+ _self.off(eventName, newCallback);
604
603
  callback.apply(null, arguments);
605
604
  });
606
605
  if (!callback) {
@@ -672,7 +671,9 @@ EventEmitter.removeEventListener = function(eventName, callback) {
672
671
  };
673
672
 
674
673
  EventEmitter.removeAllListeners = function(eventName) {
675
- if (this._eventRegistry) this._eventRegistry[eventName] = [];
674
+ if (!eventName) this._eventRegistry = this._defaultHandlers = undefined;
675
+ if (this._eventRegistry) this._eventRegistry[eventName] = undefined;
676
+ if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined;
676
677
  };
677
678
 
678
679
  exports.EventEmitter = EventEmitter;
@@ -772,7 +773,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
772
773
  });
773
774
  };
774
775
  this.detach = function() {
775
- this.document.removeEventListener("change", this.$onChange);
776
+ this.document.off("change", this.$onChange);
776
777
  };
777
778
  this.attach = function(doc) {
778
779
  this.document = doc || this.document;
@@ -1104,6 +1105,16 @@ var Document = function(textOrLines) {
1104
1105
  }
1105
1106
  };
1106
1107
 
1108
+ this.$safeApplyDelta = function(delta) {
1109
+ var docLength = this.$lines.length;
1110
+ if (
1111
+ delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength
1112
+ || delta.action == "insert" && delta.start.row <= docLength
1113
+ ) {
1114
+ this.applyDelta(delta);
1115
+ }
1116
+ };
1117
+
1107
1118
  this.$splitAndapplyLargeDelta = function(delta, MAX) {
1108
1119
  var lines = delta.lines;
1109
1120
  var l = lines.length - MAX + 1;
@@ -1126,7 +1137,7 @@ var Document = function(textOrLines) {
1126
1137
  this.applyDelta(delta, true);
1127
1138
  };
1128
1139
  this.revertDelta = function(delta) {
1129
- this.applyDelta({
1140
+ this.$safeApplyDelta({
1130
1141
  start: this.clonePos(delta.start),
1131
1142
  end: this.clonePos(delta.end),
1132
1143
  action: (delta.action == "insert" ? "remove" : "insert"),
@@ -1702,700 +1713,3 @@ oop.inherits(JsonWorker, Mirror);
1702
1713
  }).call(JsonWorker.prototype);
1703
1714
 
1704
1715
  });
1705
-
1706
- define("ace/lib/es5-shim",[], function(require, exports, module) {
1707
-
1708
- function Empty() {}
1709
-
1710
- if (!Function.prototype.bind) {
1711
- Function.prototype.bind = function bind(that) { // .length is 1
1712
- var target = this;
1713
- if (typeof target != "function") {
1714
- throw new TypeError("Function.prototype.bind called on incompatible " + target);
1715
- }
1716
- var args = slice.call(arguments, 1); // for normal call
1717
- var bound = function () {
1718
-
1719
- if (this instanceof bound) {
1720
-
1721
- var result = target.apply(
1722
- this,
1723
- args.concat(slice.call(arguments))
1724
- );
1725
- if (Object(result) === result) {
1726
- return result;
1727
- }
1728
- return this;
1729
-
1730
- } else {
1731
- return target.apply(
1732
- that,
1733
- args.concat(slice.call(arguments))
1734
- );
1735
-
1736
- }
1737
-
1738
- };
1739
- if(target.prototype) {
1740
- Empty.prototype = target.prototype;
1741
- bound.prototype = new Empty();
1742
- Empty.prototype = null;
1743
- }
1744
- return bound;
1745
- };
1746
- }
1747
- var call = Function.prototype.call;
1748
- var prototypeOfArray = Array.prototype;
1749
- var prototypeOfObject = Object.prototype;
1750
- var slice = prototypeOfArray.slice;
1751
- var _toString = call.bind(prototypeOfObject.toString);
1752
- var owns = call.bind(prototypeOfObject.hasOwnProperty);
1753
- var defineGetter;
1754
- var defineSetter;
1755
- var lookupGetter;
1756
- var lookupSetter;
1757
- var supportsAccessors;
1758
- if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
1759
- defineGetter = call.bind(prototypeOfObject.__defineGetter__);
1760
- defineSetter = call.bind(prototypeOfObject.__defineSetter__);
1761
- lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
1762
- lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
1763
- }
1764
- if ([1,2].splice(0).length != 2) {
1765
- if(function() { // test IE < 9 to splice bug - see issue #138
1766
- function makeArray(l) {
1767
- var a = new Array(l+2);
1768
- a[0] = a[1] = 0;
1769
- return a;
1770
- }
1771
- var array = [], lengthBefore;
1772
-
1773
- array.splice.apply(array, makeArray(20));
1774
- array.splice.apply(array, makeArray(26));
1775
-
1776
- lengthBefore = array.length; //46
1777
- array.splice(5, 0, "XXX"); // add one element
1778
-
1779
- lengthBefore + 1 == array.length
1780
-
1781
- if (lengthBefore + 1 == array.length) {
1782
- return true;// has right splice implementation without bugs
1783
- }
1784
- }()) {//IE 6/7
1785
- var array_splice = Array.prototype.splice;
1786
- Array.prototype.splice = function(start, deleteCount) {
1787
- if (!arguments.length) {
1788
- return [];
1789
- } else {
1790
- return array_splice.apply(this, [
1791
- start === void 0 ? 0 : start,
1792
- deleteCount === void 0 ? (this.length - start) : deleteCount
1793
- ].concat(slice.call(arguments, 2)))
1794
- }
1795
- };
1796
- } else {//IE8
1797
- Array.prototype.splice = function(pos, removeCount){
1798
- var length = this.length;
1799
- if (pos > 0) {
1800
- if (pos > length)
1801
- pos = length;
1802
- } else if (pos == void 0) {
1803
- pos = 0;
1804
- } else if (pos < 0) {
1805
- pos = Math.max(length + pos, 0);
1806
- }
1807
-
1808
- if (!(pos+removeCount < length))
1809
- removeCount = length - pos;
1810
-
1811
- var removed = this.slice(pos, pos+removeCount);
1812
- var insert = slice.call(arguments, 2);
1813
- var add = insert.length;
1814
- if (pos === length) {
1815
- if (add) {
1816
- this.push.apply(this, insert);
1817
- }
1818
- } else {
1819
- var remove = Math.min(removeCount, length - pos);
1820
- var tailOldPos = pos + remove;
1821
- var tailNewPos = tailOldPos + add - remove;
1822
- var tailCount = length - tailOldPos;
1823
- var lengthAfterRemove = length - remove;
1824
-
1825
- if (tailNewPos < tailOldPos) { // case A
1826
- for (var i = 0; i < tailCount; ++i) {
1827
- this[tailNewPos+i] = this[tailOldPos+i];
1828
- }
1829
- } else if (tailNewPos > tailOldPos) { // case B
1830
- for (i = tailCount; i--; ) {
1831
- this[tailNewPos+i] = this[tailOldPos+i];
1832
- }
1833
- } // else, add == remove (nothing to do)
1834
-
1835
- if (add && pos === lengthAfterRemove) {
1836
- this.length = lengthAfterRemove; // truncate array
1837
- this.push.apply(this, insert);
1838
- } else {
1839
- this.length = lengthAfterRemove + add; // reserves space
1840
- for (i = 0; i < add; ++i) {
1841
- this[pos+i] = insert[i];
1842
- }
1843
- }
1844
- }
1845
- return removed;
1846
- };
1847
- }
1848
- }
1849
- if (!Array.isArray) {
1850
- Array.isArray = function isArray(obj) {
1851
- return _toString(obj) == "[object Array]";
1852
- };
1853
- }
1854
- var boxedString = Object("a"),
1855
- splitString = boxedString[0] != "a" || !(0 in boxedString);
1856
-
1857
- if (!Array.prototype.forEach) {
1858
- Array.prototype.forEach = function forEach(fun /*, thisp*/) {
1859
- var object = toObject(this),
1860
- self = splitString && _toString(this) == "[object String]" ?
1861
- this.split("") :
1862
- object,
1863
- thisp = arguments[1],
1864
- i = -1,
1865
- length = self.length >>> 0;
1866
- if (_toString(fun) != "[object Function]") {
1867
- throw new TypeError(); // TODO message
1868
- }
1869
-
1870
- while (++i < length) {
1871
- if (i in self) {
1872
- fun.call(thisp, self[i], i, object);
1873
- }
1874
- }
1875
- };
1876
- }
1877
- if (!Array.prototype.map) {
1878
- Array.prototype.map = function map(fun /*, thisp*/) {
1879
- var object = toObject(this),
1880
- self = splitString && _toString(this) == "[object String]" ?
1881
- this.split("") :
1882
- object,
1883
- length = self.length >>> 0,
1884
- result = Array(length),
1885
- thisp = arguments[1];
1886
- if (_toString(fun) != "[object Function]") {
1887
- throw new TypeError(fun + " is not a function");
1888
- }
1889
-
1890
- for (var i = 0; i < length; i++) {
1891
- if (i in self)
1892
- result[i] = fun.call(thisp, self[i], i, object);
1893
- }
1894
- return result;
1895
- };
1896
- }
1897
- if (!Array.prototype.filter) {
1898
- Array.prototype.filter = function filter(fun /*, thisp */) {
1899
- var object = toObject(this),
1900
- self = splitString && _toString(this) == "[object String]" ?
1901
- this.split("") :
1902
- object,
1903
- length = self.length >>> 0,
1904
- result = [],
1905
- value,
1906
- thisp = arguments[1];
1907
- if (_toString(fun) != "[object Function]") {
1908
- throw new TypeError(fun + " is not a function");
1909
- }
1910
-
1911
- for (var i = 0; i < length; i++) {
1912
- if (i in self) {
1913
- value = self[i];
1914
- if (fun.call(thisp, value, i, object)) {
1915
- result.push(value);
1916
- }
1917
- }
1918
- }
1919
- return result;
1920
- };
1921
- }
1922
- if (!Array.prototype.every) {
1923
- Array.prototype.every = function every(fun /*, thisp */) {
1924
- var object = toObject(this),
1925
- self = splitString && _toString(this) == "[object String]" ?
1926
- this.split("") :
1927
- object,
1928
- length = self.length >>> 0,
1929
- thisp = arguments[1];
1930
- if (_toString(fun) != "[object Function]") {
1931
- throw new TypeError(fun + " is not a function");
1932
- }
1933
-
1934
- for (var i = 0; i < length; i++) {
1935
- if (i in self && !fun.call(thisp, self[i], i, object)) {
1936
- return false;
1937
- }
1938
- }
1939
- return true;
1940
- };
1941
- }
1942
- if (!Array.prototype.some) {
1943
- Array.prototype.some = function some(fun /*, thisp */) {
1944
- var object = toObject(this),
1945
- self = splitString && _toString(this) == "[object String]" ?
1946
- this.split("") :
1947
- object,
1948
- length = self.length >>> 0,
1949
- thisp = arguments[1];
1950
- if (_toString(fun) != "[object Function]") {
1951
- throw new TypeError(fun + " is not a function");
1952
- }
1953
-
1954
- for (var i = 0; i < length; i++) {
1955
- if (i in self && fun.call(thisp, self[i], i, object)) {
1956
- return true;
1957
- }
1958
- }
1959
- return false;
1960
- };
1961
- }
1962
- if (!Array.prototype.reduce) {
1963
- Array.prototype.reduce = function reduce(fun /*, initial*/) {
1964
- var object = toObject(this),
1965
- self = splitString && _toString(this) == "[object String]" ?
1966
- this.split("") :
1967
- object,
1968
- length = self.length >>> 0;
1969
- if (_toString(fun) != "[object Function]") {
1970
- throw new TypeError(fun + " is not a function");
1971
- }
1972
- if (!length && arguments.length == 1) {
1973
- throw new TypeError("reduce of empty array with no initial value");
1974
- }
1975
-
1976
- var i = 0;
1977
- var result;
1978
- if (arguments.length >= 2) {
1979
- result = arguments[1];
1980
- } else {
1981
- do {
1982
- if (i in self) {
1983
- result = self[i++];
1984
- break;
1985
- }
1986
- if (++i >= length) {
1987
- throw new TypeError("reduce of empty array with no initial value");
1988
- }
1989
- } while (true);
1990
- }
1991
-
1992
- for (; i < length; i++) {
1993
- if (i in self) {
1994
- result = fun.call(void 0, result, self[i], i, object);
1995
- }
1996
- }
1997
-
1998
- return result;
1999
- };
2000
- }
2001
- if (!Array.prototype.reduceRight) {
2002
- Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
2003
- var object = toObject(this),
2004
- self = splitString && _toString(this) == "[object String]" ?
2005
- this.split("") :
2006
- object,
2007
- length = self.length >>> 0;
2008
- if (_toString(fun) != "[object Function]") {
2009
- throw new TypeError(fun + " is not a function");
2010
- }
2011
- if (!length && arguments.length == 1) {
2012
- throw new TypeError("reduceRight of empty array with no initial value");
2013
- }
2014
-
2015
- var result, i = length - 1;
2016
- if (arguments.length >= 2) {
2017
- result = arguments[1];
2018
- } else {
2019
- do {
2020
- if (i in self) {
2021
- result = self[i--];
2022
- break;
2023
- }
2024
- if (--i < 0) {
2025
- throw new TypeError("reduceRight of empty array with no initial value");
2026
- }
2027
- } while (true);
2028
- }
2029
-
2030
- do {
2031
- if (i in this) {
2032
- result = fun.call(void 0, result, self[i], i, object);
2033
- }
2034
- } while (i--);
2035
-
2036
- return result;
2037
- };
2038
- }
2039
- if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
2040
- Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
2041
- var self = splitString && _toString(this) == "[object String]" ?
2042
- this.split("") :
2043
- toObject(this),
2044
- length = self.length >>> 0;
2045
-
2046
- if (!length) {
2047
- return -1;
2048
- }
2049
-
2050
- var i = 0;
2051
- if (arguments.length > 1) {
2052
- i = toInteger(arguments[1]);
2053
- }
2054
- i = i >= 0 ? i : Math.max(0, length + i);
2055
- for (; i < length; i++) {
2056
- if (i in self && self[i] === sought) {
2057
- return i;
2058
- }
2059
- }
2060
- return -1;
2061
- };
2062
- }
2063
- if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
2064
- Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
2065
- var self = splitString && _toString(this) == "[object String]" ?
2066
- this.split("") :
2067
- toObject(this),
2068
- length = self.length >>> 0;
2069
-
2070
- if (!length) {
2071
- return -1;
2072
- }
2073
- var i = length - 1;
2074
- if (arguments.length > 1) {
2075
- i = Math.min(i, toInteger(arguments[1]));
2076
- }
2077
- i = i >= 0 ? i : length - Math.abs(i);
2078
- for (; i >= 0; i--) {
2079
- if (i in self && sought === self[i]) {
2080
- return i;
2081
- }
2082
- }
2083
- return -1;
2084
- };
2085
- }
2086
- if (!Object.getPrototypeOf) {
2087
- Object.getPrototypeOf = function getPrototypeOf(object) {
2088
- return object.__proto__ || (
2089
- object.constructor ?
2090
- object.constructor.prototype :
2091
- prototypeOfObject
2092
- );
2093
- };
2094
- }
2095
- if (!Object.getOwnPropertyDescriptor) {
2096
- var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
2097
- "non-object: ";
2098
- Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
2099
- if ((typeof object != "object" && typeof object != "function") || object === null)
2100
- throw new TypeError(ERR_NON_OBJECT + object);
2101
- if (!owns(object, property))
2102
- return;
2103
-
2104
- var descriptor, getter, setter;
2105
- descriptor = { enumerable: true, configurable: true };
2106
- if (supportsAccessors) {
2107
- var prototype = object.__proto__;
2108
- object.__proto__ = prototypeOfObject;
2109
-
2110
- var getter = lookupGetter(object, property);
2111
- var setter = lookupSetter(object, property);
2112
- object.__proto__ = prototype;
2113
-
2114
- if (getter || setter) {
2115
- if (getter) descriptor.get = getter;
2116
- if (setter) descriptor.set = setter;
2117
- return descriptor;
2118
- }
2119
- }
2120
- descriptor.value = object[property];
2121
- return descriptor;
2122
- };
2123
- }
2124
- if (!Object.getOwnPropertyNames) {
2125
- Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
2126
- return Object.keys(object);
2127
- };
2128
- }
2129
- if (!Object.create) {
2130
- var createEmpty;
2131
- if (Object.prototype.__proto__ === null) {
2132
- createEmpty = function () {
2133
- return { "__proto__": null };
2134
- };
2135
- } else {
2136
- createEmpty = function () {
2137
- var empty = {};
2138
- for (var i in empty)
2139
- empty[i] = null;
2140
- empty.constructor =
2141
- empty.hasOwnProperty =
2142
- empty.propertyIsEnumerable =
2143
- empty.isPrototypeOf =
2144
- empty.toLocaleString =
2145
- empty.toString =
2146
- empty.valueOf =
2147
- empty.__proto__ = null;
2148
- return empty;
2149
- }
2150
- }
2151
-
2152
- Object.create = function create(prototype, properties) {
2153
- var object;
2154
- if (prototype === null) {
2155
- object = createEmpty();
2156
- } else {
2157
- if (typeof prototype != "object")
2158
- throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
2159
- var Type = function () {};
2160
- Type.prototype = prototype;
2161
- object = new Type();
2162
- object.__proto__ = prototype;
2163
- }
2164
- if (properties !== void 0)
2165
- Object.defineProperties(object, properties);
2166
- return object;
2167
- };
2168
- }
2169
-
2170
- function doesDefinePropertyWork(object) {
2171
- try {
2172
- Object.defineProperty(object, "sentinel", {});
2173
- return "sentinel" in object;
2174
- } catch (exception) {
2175
- }
2176
- }
2177
- if (Object.defineProperty) {
2178
- var definePropertyWorksOnObject = doesDefinePropertyWork({});
2179
- var definePropertyWorksOnDom = typeof document == "undefined" ||
2180
- doesDefinePropertyWork(document.createElement("div"));
2181
- if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
2182
- var definePropertyFallback = Object.defineProperty;
2183
- }
2184
- }
2185
-
2186
- if (!Object.defineProperty || definePropertyFallback) {
2187
- var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
2188
- var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
2189
- var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
2190
- "on this javascript engine";
2191
-
2192
- Object.defineProperty = function defineProperty(object, property, descriptor) {
2193
- if ((typeof object != "object" && typeof object != "function") || object === null)
2194
- throw new TypeError(ERR_NON_OBJECT_TARGET + object);
2195
- if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
2196
- throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
2197
- if (definePropertyFallback) {
2198
- try {
2199
- return definePropertyFallback.call(Object, object, property, descriptor);
2200
- } catch (exception) {
2201
- }
2202
- }
2203
- if (owns(descriptor, "value")) {
2204
-
2205
- if (supportsAccessors && (lookupGetter(object, property) ||
2206
- lookupSetter(object, property)))
2207
- {
2208
- var prototype = object.__proto__;
2209
- object.__proto__ = prototypeOfObject;
2210
- delete object[property];
2211
- object[property] = descriptor.value;
2212
- object.__proto__ = prototype;
2213
- } else {
2214
- object[property] = descriptor.value;
2215
- }
2216
- } else {
2217
- if (!supportsAccessors)
2218
- throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
2219
- if (owns(descriptor, "get"))
2220
- defineGetter(object, property, descriptor.get);
2221
- if (owns(descriptor, "set"))
2222
- defineSetter(object, property, descriptor.set);
2223
- }
2224
-
2225
- return object;
2226
- };
2227
- }
2228
- if (!Object.defineProperties) {
2229
- Object.defineProperties = function defineProperties(object, properties) {
2230
- for (var property in properties) {
2231
- if (owns(properties, property))
2232
- Object.defineProperty(object, property, properties[property]);
2233
- }
2234
- return object;
2235
- };
2236
- }
2237
- if (!Object.seal) {
2238
- Object.seal = function seal(object) {
2239
- return object;
2240
- };
2241
- }
2242
- if (!Object.freeze) {
2243
- Object.freeze = function freeze(object) {
2244
- return object;
2245
- };
2246
- }
2247
- try {
2248
- Object.freeze(function () {});
2249
- } catch (exception) {
2250
- Object.freeze = (function freeze(freezeObject) {
2251
- return function freeze(object) {
2252
- if (typeof object == "function") {
2253
- return object;
2254
- } else {
2255
- return freezeObject(object);
2256
- }
2257
- };
2258
- })(Object.freeze);
2259
- }
2260
- if (!Object.preventExtensions) {
2261
- Object.preventExtensions = function preventExtensions(object) {
2262
- return object;
2263
- };
2264
- }
2265
- if (!Object.isSealed) {
2266
- Object.isSealed = function isSealed(object) {
2267
- return false;
2268
- };
2269
- }
2270
- if (!Object.isFrozen) {
2271
- Object.isFrozen = function isFrozen(object) {
2272
- return false;
2273
- };
2274
- }
2275
- if (!Object.isExtensible) {
2276
- Object.isExtensible = function isExtensible(object) {
2277
- if (Object(object) === object) {
2278
- throw new TypeError(); // TODO message
2279
- }
2280
- var name = '';
2281
- while (owns(object, name)) {
2282
- name += '?';
2283
- }
2284
- object[name] = true;
2285
- var returnValue = owns(object, name);
2286
- delete object[name];
2287
- return returnValue;
2288
- };
2289
- }
2290
- if (!Object.keys) {
2291
- var hasDontEnumBug = true,
2292
- dontEnums = [
2293
- "toString",
2294
- "toLocaleString",
2295
- "valueOf",
2296
- "hasOwnProperty",
2297
- "isPrototypeOf",
2298
- "propertyIsEnumerable",
2299
- "constructor"
2300
- ],
2301
- dontEnumsLength = dontEnums.length;
2302
-
2303
- for (var key in {"toString": null}) {
2304
- hasDontEnumBug = false;
2305
- }
2306
-
2307
- Object.keys = function keys(object) {
2308
-
2309
- if (
2310
- (typeof object != "object" && typeof object != "function") ||
2311
- object === null
2312
- ) {
2313
- throw new TypeError("Object.keys called on a non-object");
2314
- }
2315
-
2316
- var keys = [];
2317
- for (var name in object) {
2318
- if (owns(object, name)) {
2319
- keys.push(name);
2320
- }
2321
- }
2322
-
2323
- if (hasDontEnumBug) {
2324
- for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
2325
- var dontEnum = dontEnums[i];
2326
- if (owns(object, dontEnum)) {
2327
- keys.push(dontEnum);
2328
- }
2329
- }
2330
- }
2331
- return keys;
2332
- };
2333
-
2334
- }
2335
- if (!Date.now) {
2336
- Date.now = function now() {
2337
- return new Date().getTime();
2338
- };
2339
- }
2340
- var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
2341
- "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
2342
- "\u2029\uFEFF";
2343
- if (!String.prototype.trim) {
2344
- ws = "[" + ws + "]";
2345
- var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
2346
- trimEndRegexp = new RegExp(ws + ws + "*$");
2347
- String.prototype.trim = function trim() {
2348
- return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
2349
- };
2350
- }
2351
-
2352
- function toInteger(n) {
2353
- n = +n;
2354
- if (n !== n) { // isNaN
2355
- n = 0;
2356
- } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
2357
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
2358
- }
2359
- return n;
2360
- }
2361
-
2362
- function isPrimitive(input) {
2363
- var type = typeof input;
2364
- return (
2365
- input === null ||
2366
- type === "undefined" ||
2367
- type === "boolean" ||
2368
- type === "number" ||
2369
- type === "string"
2370
- );
2371
- }
2372
-
2373
- function toPrimitive(input) {
2374
- var val, valueOf, toString;
2375
- if (isPrimitive(input)) {
2376
- return input;
2377
- }
2378
- valueOf = input.valueOf;
2379
- if (typeof valueOf === "function") {
2380
- val = valueOf.call(input);
2381
- if (isPrimitive(val)) {
2382
- return val;
2383
- }
2384
- }
2385
- toString = input.toString;
2386
- if (typeof toString === "function") {
2387
- val = toString.call(input);
2388
- if (isPrimitive(val)) {
2389
- return val;
2390
- }
2391
- }
2392
- throw new TypeError();
2393
- }
2394
- var toObject = function (o) {
2395
- if (o == null) { // this matches both null and undefined
2396
- throw new TypeError("can't convert "+o+" to object");
2397
- }
2398
- return Object(o);
2399
- };
2400
-
2401
- });