jruby_activiti 1.2.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (317) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG +6 -0
  5. data/Jarfile +5 -0
  6. data/Jarfile.lock +52 -13
  7. data/README.md +21 -9
  8. data/java/build.md +3 -0
  9. data/java/mapping.md +20 -0
  10. data/java/pom.xml +30 -0
  11. data/java/src/main/java/jrubyactiviti/Modeler.java +95 -0
  12. data/java/src/main/java/jrubyactiviti/ProcessDiagram.java +491 -0
  13. data/java/src/main/java/jrubyactiviti/ProcessInstanceHighlights.java +237 -0
  14. data/java/src/main/java/jrubyactiviti/StencilsetResource.java +16 -0
  15. data/java/src/main/resources/stencilset.json +1339 -0
  16. data/jruby_activiti.gemspec +3 -2
  17. data/lib/generators/jruby_activiti/install_generator.rb +4 -0
  18. data/lib/jar/jrubyactiviti-2.0.jar +0 -0
  19. data/lib/jruby_activiti/version.rb +1 -1
  20. data/lib/jruby_activiti/web.rb +81 -0
  21. data/lib/jruby_activiti.rb +28 -20
  22. data/test/{base_test.rb → activiti_test.rb} +1 -3
  23. data/test/instance_hights_test.rb +18 -0
  24. data/test/modeler_test.rb +35 -0
  25. data/test/process_diagram_test.rb +33 -0
  26. data/test/resources/model_init_editor_source.json +1 -0
  27. data/test/resources/model_json_xml.json +278 -0
  28. data/test/resources/model_svg_xml.xml +66 -0
  29. data/test/stencilset_test.rb +7 -0
  30. data/test/test_helper.rb +2 -0
  31. data/web/public/diagram-viewer/images/bg.png +0 -0
  32. data/web/public/diagram-viewer/images/breadcrumbs.png +0 -0
  33. data/web/public/diagram-viewer/images/checker-bg.png +0 -0
  34. data/web/public/diagram-viewer/images/deployer/blue/message_catch.png +0 -0
  35. data/web/public/diagram-viewer/images/deployer/business_rule.png +0 -0
  36. data/web/public/diagram-viewer/images/deployer/error_catch.png +0 -0
  37. data/web/public/diagram-viewer/images/deployer/error_throw.png +0 -0
  38. data/web/public/diagram-viewer/images/deployer/manual.png +0 -0
  39. data/web/public/diagram-viewer/images/deployer/message_catch.png +0 -0
  40. data/web/public/diagram-viewer/images/deployer/message_throw.png +0 -0
  41. data/web/public/diagram-viewer/images/deployer/receive.png +0 -0
  42. data/web/public/diagram-viewer/images/deployer/script.png +0 -0
  43. data/web/public/diagram-viewer/images/deployer/send.png +0 -0
  44. data/web/public/diagram-viewer/images/deployer/service.png +0 -0
  45. data/web/public/diagram-viewer/images/deployer/signal_catch.png +0 -0
  46. data/web/public/diagram-viewer/images/deployer/signal_throw.png +0 -0
  47. data/web/public/diagram-viewer/images/deployer/timer.png +0 -0
  48. data/web/public/diagram-viewer/images/deployer/user.png +0 -0
  49. data/web/public/diagram-viewer/index.html +130 -0
  50. data/web/public/diagram-viewer/js/ActivitiRest.js +74 -0
  51. data/web/public/diagram-viewer/js/ActivityImpl.js +1 -0
  52. data/web/public/diagram-viewer/js/Color.js +603 -0
  53. data/web/public/diagram-viewer/js/LineBreakMeasurer.js +270 -0
  54. data/web/public/diagram-viewer/js/Polyline.js +387 -0
  55. data/web/public/diagram-viewer/js/ProcessDiagramCanvas.js +2172 -0
  56. data/web/public/diagram-viewer/js/ProcessDiagramGenerator.js +1087 -0
  57. data/web/public/diagram-viewer/js/jquery/jquery.asyncqueue.js +125 -0
  58. data/web/public/diagram-viewer/js/jquery/jquery.js +9266 -0
  59. data/web/public/diagram-viewer/js/jquery/jquery.progressbar.js +131 -0
  60. data/web/public/diagram-viewer/js/jstools.js +23 -0
  61. data/web/public/diagram-viewer/js/raphael.2.1.1.js +10 -0
  62. data/web/public/diagram-viewer/js/raphael.js +10 -0
  63. data/web/public/diagram-viewer/js/raphael_uncompressed.js +5815 -0
  64. data/web/public/diagram-viewer/js/textlayout.js +441 -0
  65. data/web/public/diagram-viewer/style.css +1 -0
  66. data/web/public/editor-app/app-cfg.js +25 -0
  67. data/web/public/editor-app/app.js +432 -0
  68. data/web/public/editor-app/configuration/properties/assignment-display-template.html +4 -0
  69. data/web/public/editor-app/configuration/properties/assignment-popup.html +44 -0
  70. data/web/public/editor-app/configuration/properties/assignment-write-template.html +4 -0
  71. data/web/public/editor-app/configuration/properties/boolean-property-template.html +4 -0
  72. data/web/public/editor-app/configuration/properties/condition-expression-display-template.html +2 -0
  73. data/web/public/editor-app/configuration/properties/condition-expression-popup.html +29 -0
  74. data/web/public/editor-app/configuration/properties/condition-expression-write-template.html +4 -0
  75. data/web/public/editor-app/configuration/properties/default-value-display-template.html +4 -0
  76. data/web/public/editor-app/configuration/properties/event-listeners-display-template.html +3 -0
  77. data/web/public/editor-app/configuration/properties/event-listeners-popup.html +115 -0
  78. data/web/public/editor-app/configuration/properties/event-listeners-write-template.html +4 -0
  79. data/web/public/editor-app/configuration/properties/execution-listeners-display-template.html +3 -0
  80. data/web/public/editor-app/configuration/properties/execution-listeners-popup.html +101 -0
  81. data/web/public/editor-app/configuration/properties/execution-listeners-write-template.html +4 -0
  82. data/web/public/editor-app/configuration/properties/feedback-popup.html +17 -0
  83. data/web/public/editor-app/configuration/properties/fields-display-template.html +3 -0
  84. data/web/public/editor-app/configuration/properties/fields-popup.html +61 -0
  85. data/web/public/editor-app/configuration/properties/fields-write-template.html +4 -0
  86. data/web/public/editor-app/configuration/properties/form-properties-display-template.html +3 -0
  87. data/web/public/editor-app/configuration/properties/form-properties-popup.html +93 -0
  88. data/web/public/editor-app/configuration/properties/form-properties-write-template.html +4 -0
  89. data/web/public/editor-app/configuration/properties/in-parameters-display-template.html +3 -0
  90. data/web/public/editor-app/configuration/properties/in-parameters-popup.html +53 -0
  91. data/web/public/editor-app/configuration/properties/in-parameters-write-template.html +4 -0
  92. data/web/public/editor-app/configuration/properties/message-definitions-display-template.html +2 -0
  93. data/web/public/editor-app/configuration/properties/message-definitions-popup.html +50 -0
  94. data/web/public/editor-app/configuration/properties/message-definitions-write-template.html +3 -0
  95. data/web/public/editor-app/configuration/properties/message-property-write-template.html +4 -0
  96. data/web/public/editor-app/configuration/properties/multiinstance-property-write-template.html +8 -0
  97. data/web/public/editor-app/configuration/properties/out-parameters-display-template.html +3 -0
  98. data/web/public/editor-app/configuration/properties/out-parameters-popup.html +53 -0
  99. data/web/public/editor-app/configuration/properties/out-parameters-write-template.html +4 -0
  100. data/web/public/editor-app/configuration/properties/sequenceflow-order-display-template.html +3 -0
  101. data/web/public/editor-app/configuration/properties/sequenceflow-order-popup.html +47 -0
  102. data/web/public/editor-app/configuration/properties/sequenceflow-order-write-template.html +4 -0
  103. data/web/public/editor-app/configuration/properties/signal-definitions-display-template.html +3 -0
  104. data/web/public/editor-app/configuration/properties/signal-definitions-popup.html +58 -0
  105. data/web/public/editor-app/configuration/properties/signal-definitions-write-template.html +4 -0
  106. data/web/public/editor-app/configuration/properties/signal-property-write-template.html +4 -0
  107. data/web/public/editor-app/configuration/properties/string-property-write-mode-template.html +8 -0
  108. data/web/public/editor-app/configuration/properties/subprocess-reference-display-template.html +3 -0
  109. data/web/public/editor-app/configuration/properties/subprocess-reference-popup.html +43 -0
  110. data/web/public/editor-app/configuration/properties/subprocess-reference-write-template.html +4 -0
  111. data/web/public/editor-app/configuration/properties/task-listeners-display-template.html +3 -0
  112. data/web/public/editor-app/configuration/properties/task-listeners-popup.html +102 -0
  113. data/web/public/editor-app/configuration/properties/task-listeners-write-template.html +4 -0
  114. data/web/public/editor-app/configuration/properties/text-popup.html +17 -0
  115. data/web/public/editor-app/configuration/properties/text-property-write-template.html +4 -0
  116. data/web/public/editor-app/configuration/properties-assignment-controller.js +150 -0
  117. data/web/public/editor-app/configuration/properties-condition-expression-controller.js +58 -0
  118. data/web/public/editor-app/configuration/properties-custom-controllers.js +18 -0
  119. data/web/public/editor-app/configuration/properties-default-controllers.js +115 -0
  120. data/web/public/editor-app/configuration/properties-event-listeners-controller.js +266 -0
  121. data/web/public/editor-app/configuration/properties-execution-listeners-controller.js +326 -0
  122. data/web/public/editor-app/configuration/properties-fields-controller.js +192 -0
  123. data/web/public/editor-app/configuration/properties-form-properties-controller.js +192 -0
  124. data/web/public/editor-app/configuration/properties-in-parameters-controller.js +158 -0
  125. data/web/public/editor-app/configuration/properties-message-definitions-controller.js +137 -0
  126. data/web/public/editor-app/configuration/properties-message-scope-controller.js +48 -0
  127. data/web/public/editor-app/configuration/properties-multiinstance-controller.js +34 -0
  128. data/web/public/editor-app/configuration/properties-out-parameters-controller.js +158 -0
  129. data/web/public/editor-app/configuration/properties-sequenceflow-order-controller.js +130 -0
  130. data/web/public/editor-app/configuration/properties-signal-definitions-controller.js +136 -0
  131. data/web/public/editor-app/configuration/properties-signal-scope-controller.js +47 -0
  132. data/web/public/editor-app/configuration/properties-task-listeners-controller.js +325 -0
  133. data/web/public/editor-app/configuration/properties.js +99 -0
  134. data/web/public/editor-app/configuration/toolbar-custom-actions.js +18 -0
  135. data/web/public/editor-app/configuration/toolbar-default-actions.js +429 -0
  136. data/web/public/editor-app/configuration/toolbar.js +175 -0
  137. data/web/public/editor-app/configuration/url-config.js +34 -0
  138. data/web/public/editor-app/css/style-common.css +1518 -0
  139. data/web/public/editor-app/css/style-editor.css +639 -0
  140. data/web/public/editor-app/css/style.css +471 -0
  141. data/web/public/editor-app/editor/css/editor.css +202 -0
  142. data/web/public/editor-app/editor/i18n/translation_de.js +383 -0
  143. data/web/public/editor-app/editor/i18n/translation_en_us.js +423 -0
  144. data/web/public/editor-app/editor/i18n/translation_signavio_de.js +106 -0
  145. data/web/public/editor-app/editor/i18n/translation_signavio_en_us.js +108 -0
  146. data/web/public/editor-app/editor/oryx.debug.js +24510 -0
  147. data/web/public/editor-app/editor/oryx.js +30 -0
  148. data/web/public/editor-app/editor-config.js +32 -0
  149. data/web/public/editor-app/editor-controller.js +65 -0
  150. data/web/public/editor-app/editor-utils.js +135 -0
  151. data/web/public/editor-app/editor.html +136 -0
  152. data/web/public/editor-app/eventbus.js +133 -0
  153. data/web/public/editor-app/fonts/activiti-admin-webfont.eot +0 -0
  154. data/web/public/editor-app/fonts/activiti-admin-webfont.svg +43 -0
  155. data/web/public/editor-app/fonts/activiti-admin-webfont.ttf +0 -0
  156. data/web/public/editor-app/fonts/activiti-admin-webfont.woff +0 -0
  157. data/web/public/editor-app/fonts/glyphicons-halflings-regular.eot +0 -0
  158. data/web/public/editor-app/fonts/glyphicons-halflings-regular.svg +229 -0
  159. data/web/public/editor-app/fonts/glyphicons-halflings-regular.ttf +0 -0
  160. data/web/public/editor-app/fonts/glyphicons-halflings-regular.woff +0 -0
  161. data/web/public/editor-app/header-controller.js +31 -0
  162. data/web/public/editor-app/i18n/en.json +286 -0
  163. data/web/public/editor-app/images/bpmn-error.png +0 -0
  164. data/web/public/editor-app/images/bpmn-warning.png +0 -0
  165. data/web/public/editor-app/images/datadefinition.png +0 -0
  166. data/web/public/editor-app/images/delete.png +0 -0
  167. data/web/public/editor-app/images/loading.gif +0 -0
  168. data/web/public/editor-app/images/logo-2x.png +0 -0
  169. data/web/public/editor-app/images/logo.png +0 -0
  170. data/web/public/editor-app/images/nw-handle-dark.gif +0 -0
  171. data/web/public/editor-app/images/se-handle-dark.gif +0 -0
  172. data/web/public/editor-app/images/shapemenu_highlight.png +0 -0
  173. data/web/public/editor-app/images/wrench.png +0 -0
  174. data/web/public/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js +8 -0
  175. data/web/public/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js.map +8 -0
  176. data/web/public/editor-app/libs/angular-dragdrop.min-1.0.3.js +9 -0
  177. data/web/public/editor-app/libs/angular-dragdrop_1.0.7/angular-dragdrop.min.js +29 -0
  178. data/web/public/editor-app/libs/angular-mocks_1.2.13/angular-mocks.js +2136 -0
  179. data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.js +596 -0
  180. data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js +13 -0
  181. data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js.map +8 -0
  182. data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.js +921 -0
  183. data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.min.js +14 -0
  184. data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.min.js.map +8 -0
  185. data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.js +625 -0
  186. data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js +14 -0
  187. data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js.map +8 -0
  188. data/web/public/editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js +1 -0
  189. data/web/public/editor-app/libs/angular-strap_2.0.5/angular-strap.min.js +9 -0
  190. data/web/public/editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js +8 -0
  191. data/web/public/editor-app/libs/angular-translate-loader-static-files/.bower.json +19 -0
  192. data/web/public/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js +31 -0
  193. data/web/public/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js +6 -0
  194. data/web/public/editor-app/libs/angular-translate-storage-cookie/.bower.json +20 -0
  195. data/web/public/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js +19 -0
  196. data/web/public/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js +6 -0
  197. data/web/public/editor-app/libs/angular-translate_2.4.2/angular-translate.js +960 -0
  198. data/web/public/editor-app/libs/angular-translate_2.4.2/angular-translate.min.js +6 -0
  199. data/web/public/editor-app/libs/angular_1.2.13/angular-animate.min.js +27 -0
  200. data/web/public/editor-app/libs/angular_1.2.13/angular.min.js +204 -0
  201. data/web/public/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker-bs3.css +267 -0
  202. data/web/public/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker.js +1026 -0
  203. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css +347 -0
  204. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css.map +1 -0
  205. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.min.css +7 -0
  206. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css +5785 -0
  207. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css.map +1 -0
  208. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css +7 -0
  209. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.eot +0 -0
  210. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.svg +229 -0
  211. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.ttf +0 -0
  212. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.woff +0 -0
  213. data/web/public/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js +1951 -0
  214. data/web/public/editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js +6 -0
  215. data/web/public/editor-app/libs/es5-shim-15.3.4.5/.bower.json +14 -0
  216. data/web/public/editor-app/libs/es5-shim-15.3.4.5/.gitignore +2 -0
  217. data/web/public/editor-app/libs/es5-shim-15.3.4.5/CHANGES +93 -0
  218. data/web/public/editor-app/libs/es5-shim-15.3.4.5/CONTRIBUTORS.md +25 -0
  219. data/web/public/editor-app/libs/es5-shim-15.3.4.5/LICENSE +19 -0
  220. data/web/public/editor-app/libs/es5-shim-15.3.4.5/README.md +161 -0
  221. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.js +444 -0
  222. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.map +1 -0
  223. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.min.js +4 -0
  224. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.js +1314 -0
  225. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.map +1 -0
  226. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.min.js +4 -0
  227. data/web/public/editor-app/libs/es5-shim-15.3.4.5/package.json +34 -0
  228. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js +64 -0
  229. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-matchers.js +34 -0
  230. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h.js +3 -0
  231. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/index.html +64 -0
  232. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/index.min.html +63 -0
  233. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine-html.js +190 -0
  234. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.css +166 -0
  235. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.js +2477 -0
  236. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine_favicon.png +0 -0
  237. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/json2.js +478 -0
  238. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-array.js +1223 -0
  239. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-date.js +152 -0
  240. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-function.js +147 -0
  241. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-number.js +14 -0
  242. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-object.js +181 -0
  243. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-string.js +204 -0
  244. data/web/public/editor-app/libs/jquery-ui-1.10.3.custom.min.js +6 -0
  245. data/web/public/editor-app/libs/jquery.autogrow-textarea.js +61 -0
  246. data/web/public/editor-app/libs/jquery_1.11.0/jquery.js +9789 -0
  247. data/web/public/editor-app/libs/jquery_1.11.0/jquery.min.js +4 -0
  248. data/web/public/editor-app/libs/jquery_1.11.0/jquery.min.map +1 -0
  249. data/web/public/editor-app/libs/json3_3.2.6/LICENSE +20 -0
  250. data/web/public/editor-app/libs/json3_3.2.6/lib/json3.js +861 -0
  251. data/web/public/editor-app/libs/json3_3.2.6/lib/json3.min.js +18 -0
  252. data/web/public/editor-app/libs/momentjs_2.5.1/momentjs.min.js +6 -0
  253. data/web/public/editor-app/libs/mousetrap-1.4.5.min.js +9 -0
  254. data/web/public/editor-app/libs/ng-grid-2.0.7-min.js +2 -0
  255. data/web/public/editor-app/libs/ng-grid-2.0.7.min.css +1 -0
  256. data/web/public/editor-app/libs/path_parser.js +30 -0
  257. data/web/public/editor-app/libs/prototype-1.5.1.js +3272 -0
  258. data/web/public/editor-app/libs/ui-utils.min-0.0.4.js +7 -0
  259. data/web/public/editor-app/partials/root-stencil-item-template.html +11 -0
  260. data/web/public/editor-app/partials/stencil-item-template.html +27 -0
  261. data/web/public/editor-app/plugins.xml +58 -0
  262. data/web/public/editor-app/popups/icon-template.html +3 -0
  263. data/web/public/editor-app/popups/save-model.html +41 -0
  264. data/web/public/editor-app/popups/select-shape.html +20 -0
  265. data/web/public/editor-app/popups/unsaved-changes.html +22 -0
  266. data/web/public/editor-app/select-shape-controller.js +314 -0
  267. data/web/public/editor-app/stencil-controller.js +1421 -0
  268. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.collapsed.png +0 -0
  269. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.png +0 -0
  270. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/expanded.subprocess.png +0 -0
  271. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.business.rule.png +0 -0
  272. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.camel.png +0 -0
  273. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.manual.png +0 -0
  274. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.mule.png +0 -0
  275. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.receive.png +0 -0
  276. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.script.png +0 -0
  277. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.send.png +0 -0
  278. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.service.png +0 -0
  279. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.shell.png +0 -0
  280. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.user.png +0 -0
  281. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/subprocess.png +0 -0
  282. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/task.png +0 -0
  283. data/web/public/editor-app/stencilsets/bpmn2.0/icons/artifact/text.annotation.png +0 -0
  284. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/cancel.png +0 -0
  285. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/compensation.png +0 -0
  286. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/error.png +0 -0
  287. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/message.png +0 -0
  288. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/signal.png +0 -0
  289. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/timer.png +0 -0
  290. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/association.undirected.png +0 -0
  291. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/association.unidirectional.png +0 -0
  292. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/messageflow.png +0 -0
  293. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/sequenceflow.png +0 -0
  294. data/web/public/editor-app/stencilsets/bpmn2.0/icons/dataobject/data.store.png +0 -0
  295. data/web/public/editor-app/stencilsets/bpmn2.0/icons/diagram.png +0 -0
  296. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/cancel.png +0 -0
  297. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/error.png +0 -0
  298. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/none.png +0 -0
  299. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/terminate.png +0 -0
  300. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/eventbased.png +0 -0
  301. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/exclusive.databased.png +0 -0
  302. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/inclusive.png +0 -0
  303. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/parallel.png +0 -0
  304. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/error.png +0 -0
  305. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/message.png +0 -0
  306. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/none.png +0 -0
  307. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/signal.png +0 -0
  308. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/timer.png +0 -0
  309. data/web/public/editor-app/stencilsets/bpmn2.0/icons/swimlane/lane.png +0 -0
  310. data/web/public/editor-app/stencilsets/bpmn2.0/icons/swimlane/pool.png +0 -0
  311. data/web/public/editor-app/stencilsets/bpmn2.0/icons/throwing/none.png +0 -0
  312. data/web/public/editor-app/stencilsets/bpmn2.0/icons/throwing/signal.png +0 -0
  313. data/web/public/editor-app/toolbar-controller.js +162 -0
  314. data/web/public/modeler.html +140 -0
  315. data/web/views/models/index.erb +32 -0
  316. data/web/views/models/new.erb +15 -0
  317. metadata +334 -10
@@ -0,0 +1,1314 @@
1
+ // Copyright 2009-2012 by contributors, MIT License
2
+ // vim: ts=4 sts=4 sw=4 expandtab
3
+
4
+ // Module systems magic dance
5
+ (function (definition) {
6
+ // RequireJS
7
+ if (typeof define == "function") {
8
+ define(definition);
9
+ // YUI3
10
+ } else if (typeof YUI == "function") {
11
+ YUI.add("es5", definition);
12
+ // CommonJS and <script>
13
+ } else {
14
+ definition();
15
+ }
16
+ })(function () {
17
+
18
+ /**
19
+ * Brings an environment as close to ECMAScript 5 compliance
20
+ * as is possible with the facilities of erstwhile engines.
21
+ *
22
+ * Annotated ES5: http://es5.github.com/ (specific links below)
23
+ * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
24
+ * Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/
25
+ */
26
+
27
+ //
28
+ // Function
29
+ // ========
30
+ //
31
+
32
+ // ES-5 15.3.4.5
33
+ // http://es5.github.com/#x15.3.4.5
34
+
35
+ function Empty() {}
36
+
37
+ if (!Function.prototype.bind) {
38
+ Function.prototype.bind = function bind(that) { // .length is 1
39
+ // 1. Let Target be the this value.
40
+ var target = this;
41
+ // 2. If IsCallable(Target) is false, throw a TypeError exception.
42
+ if (typeof target != "function") {
43
+ throw new TypeError("Function.prototype.bind called on incompatible " + target);
44
+ }
45
+ // 3. Let A be a new (possibly empty) internal list of all of the
46
+ // argument values provided after thisArg (arg1, arg2 etc), in order.
47
+ // XXX slicedArgs will stand in for "A" if used
48
+ var args = _Array_slice_.call(arguments, 1); // for normal call
49
+ // 4. Let F be a new native ECMAScript object.
50
+ // 11. Set the [[Prototype]] internal property of F to the standard
51
+ // built-in Function prototype object as specified in 15.3.3.1.
52
+ // 12. Set the [[Call]] internal property of F as described in
53
+ // 15.3.4.5.1.
54
+ // 13. Set the [[Construct]] internal property of F as described in
55
+ // 15.3.4.5.2.
56
+ // 14. Set the [[HasInstance]] internal property of F as described in
57
+ // 15.3.4.5.3.
58
+ var bound = function () {
59
+
60
+ if (this instanceof bound) {
61
+ // 15.3.4.5.2 [[Construct]]
62
+ // When the [[Construct]] internal method of a function object,
63
+ // F that was created using the bind function is called with a
64
+ // list of arguments ExtraArgs, the following steps are taken:
65
+ // 1. Let target be the value of F's [[TargetFunction]]
66
+ // internal property.
67
+ // 2. If target has no [[Construct]] internal method, a
68
+ // TypeError exception is thrown.
69
+ // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
70
+ // property.
71
+ // 4. Let args be a new list containing the same values as the
72
+ // list boundArgs in the same order followed by the same
73
+ // values as the list ExtraArgs in the same order.
74
+ // 5. Return the result of calling the [[Construct]] internal
75
+ // method of target providing args as the arguments.
76
+
77
+ var result = target.apply(
78
+ this,
79
+ args.concat(_Array_slice_.call(arguments))
80
+ );
81
+ if (Object(result) === result) {
82
+ return result;
83
+ }
84
+ return this;
85
+
86
+ } else {
87
+ // 15.3.4.5.1 [[Call]]
88
+ // When the [[Call]] internal method of a function object, F,
89
+ // which was created using the bind function is called with a
90
+ // this value and a list of arguments ExtraArgs, the following
91
+ // steps are taken:
92
+ // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
93
+ // property.
94
+ // 2. Let boundThis be the value of F's [[BoundThis]] internal
95
+ // property.
96
+ // 3. Let target be the value of F's [[TargetFunction]] internal
97
+ // property.
98
+ // 4. Let args be a new list containing the same values as the
99
+ // list boundArgs in the same order followed by the same
100
+ // values as the list ExtraArgs in the same order.
101
+ // 5. Return the result of calling the [[Call]] internal method
102
+ // of target providing boundThis as the this value and
103
+ // providing args as the arguments.
104
+
105
+ // equiv: target.call(this, ...boundArgs, ...args)
106
+ return target.apply(
107
+ that,
108
+ args.concat(_Array_slice_.call(arguments))
109
+ );
110
+
111
+ }
112
+
113
+ };
114
+ if(target.prototype) {
115
+ Empty.prototype = target.prototype;
116
+ bound.prototype = new Empty();
117
+ // Clean up dangling references.
118
+ Empty.prototype = null;
119
+ }
120
+ // XXX bound.length is never writable, so don't even try
121
+ //
122
+ // 15. If the [[Class]] internal property of Target is "Function", then
123
+ // a. Let L be the length property of Target minus the length of A.
124
+ // b. Set the length own property of F to either 0 or L, whichever is
125
+ // larger.
126
+ // 16. Else set the length own property of F to 0.
127
+ // 17. Set the attributes of the length own property of F to the values
128
+ // specified in 15.3.5.1.
129
+
130
+ // TODO
131
+ // 18. Set the [[Extensible]] internal property of F to true.
132
+
133
+ // TODO
134
+ // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
135
+ // 20. Call the [[DefineOwnProperty]] internal method of F with
136
+ // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
137
+ // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
138
+ // false.
139
+ // 21. Call the [[DefineOwnProperty]] internal method of F with
140
+ // arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
141
+ // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
142
+ // and false.
143
+
144
+ // TODO
145
+ // NOTE Function objects created using Function.prototype.bind do not
146
+ // have a prototype property or the [[Code]], [[FormalParameters]], and
147
+ // [[Scope]] internal properties.
148
+ // XXX can't delete prototype in pure-js.
149
+
150
+ // 22. Return F.
151
+ return bound;
152
+ };
153
+ }
154
+
155
+ // Shortcut to an often accessed properties, in order to avoid multiple
156
+ // dereference that costs universally.
157
+ // _Please note: Shortcuts are defined after `Function.prototype.bind` as we
158
+ // us it in defining shortcuts.
159
+ var call = Function.prototype.call;
160
+ var prototypeOfArray = Array.prototype;
161
+ var prototypeOfObject = Object.prototype;
162
+ var _Array_slice_ = prototypeOfArray.slice;
163
+ // Having a toString local variable name breaks in Opera so use _toString.
164
+ var _toString = call.bind(prototypeOfObject.toString);
165
+ var owns = call.bind(prototypeOfObject.hasOwnProperty);
166
+
167
+ // If JS engine supports accessors creating shortcuts.
168
+ var defineGetter;
169
+ var defineSetter;
170
+ var lookupGetter;
171
+ var lookupSetter;
172
+ var supportsAccessors;
173
+ if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
174
+ defineGetter = call.bind(prototypeOfObject.__defineGetter__);
175
+ defineSetter = call.bind(prototypeOfObject.__defineSetter__);
176
+ lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
177
+ lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
178
+ }
179
+
180
+ //
181
+ // Array
182
+ // =====
183
+ //
184
+
185
+ // ES5 15.4.4.12
186
+ // http://es5.github.com/#x15.4.4.12
187
+ // Default value for second param
188
+ // [bugfix, ielt9, old browsers]
189
+ // IE < 9 bug: [1,2].splice(0).join("") == "" but should be "12"
190
+ if ([1,2].splice(0).length != 2) {
191
+ var array_splice = Array.prototype.splice;
192
+
193
+ if(function() { // test IE < 9 to splice bug - see issue #138
194
+ function makeArray(l) {
195
+ var a = [];
196
+ while (l--) {
197
+ a.unshift(l)
198
+ }
199
+ return a
200
+ }
201
+
202
+ var array = []
203
+ , lengthBefore
204
+ ;
205
+
206
+ array.splice.bind(array, 0, 0).apply(null, makeArray(20));
207
+ array.splice.bind(array, 0, 0).apply(null, makeArray(26));
208
+
209
+ lengthBefore = array.length; //20
210
+ array.splice(5, 0, "XXX"); // add one element
211
+
212
+ if(lengthBefore + 1 == array.length) {
213
+ return true;// has right splice implementation without bugs
214
+ }
215
+ // else {
216
+ // IE8 bug
217
+ // }
218
+ }()) {//IE 6/7
219
+ Array.prototype.splice = function(start, deleteCount) {
220
+ if (!arguments.length) {
221
+ return [];
222
+ } else {
223
+ return array_splice.apply(this, [
224
+ start === void 0 ? 0 : start,
225
+ deleteCount === void 0 ? (this.length - start) : deleteCount
226
+ ].concat(_Array_slice_.call(arguments, 2)))
227
+ }
228
+ };
229
+ }
230
+ else {//IE8
231
+ Array.prototype.splice = function(start, deleteCount) {
232
+ var result
233
+ , args = _Array_slice_.call(arguments, 2)
234
+ , addElementsCount = args.length
235
+ ;
236
+
237
+ if(!arguments.length) {
238
+ return [];
239
+ }
240
+
241
+ if(start === void 0) { // default
242
+ start = 0;
243
+ }
244
+ if(deleteCount === void 0) { // default
245
+ deleteCount = this.length - start;
246
+ }
247
+
248
+ if(addElementsCount > 0) {
249
+ if(deleteCount <= 0) {
250
+ if(start == this.length) { // tiny optimisation #1
251
+ this.push.apply(this, args);
252
+ return [];
253
+ }
254
+
255
+ if(start == 0) { // tiny optimisation #2
256
+ this.unshift.apply(this, args);
257
+ return [];
258
+ }
259
+ }
260
+
261
+ // Array.prototype.splice implementation
262
+ result = _Array_slice_.call(this, start, start + deleteCount);// delete part
263
+ args.push.apply(args, _Array_slice_.call(this, start + deleteCount, this.length));// right part
264
+ args.unshift.apply(args, _Array_slice_.call(this, 0, start));// left part
265
+
266
+ // delete all items from this array and replace it to 'left part' + _Array_slice_.call(arguments, 2) + 'right part'
267
+ args.unshift(0, this.length);
268
+
269
+ array_splice.apply(this, args);
270
+
271
+ return result;
272
+ }
273
+
274
+ return array_splice.call(this, start, deleteCount);
275
+ }
276
+
277
+ }
278
+ }
279
+
280
+ // ES5 15.4.4.12
281
+ // http://es5.github.com/#x15.4.4.13
282
+ // Return len+argCount.
283
+ // [bugfix, ielt8]
284
+ // IE < 8 bug: [].unshift(0) == undefined but should be "1"
285
+ if ([].unshift(0) != 1) {
286
+ var array_unshift = Array.prototype.unshift;
287
+ Array.prototype.unshift = function() {
288
+ array_unshift.apply(this, arguments);
289
+ return this.length;
290
+ };
291
+ }
292
+
293
+ // ES5 15.4.3.2
294
+ // http://es5.github.com/#x15.4.3.2
295
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
296
+ if (!Array.isArray) {
297
+ Array.isArray = function isArray(obj) {
298
+ return _toString(obj) == "[object Array]";
299
+ };
300
+ }
301
+
302
+ // The IsCallable() check in the Array functions
303
+ // has been replaced with a strict check on the
304
+ // internal class of the object to trap cases where
305
+ // the provided function was actually a regular
306
+ // expression literal, which in V8 and
307
+ // JavaScriptCore is a typeof "function". Only in
308
+ // V8 are regular expression literals permitted as
309
+ // reduce parameters, so it is desirable in the
310
+ // general case for the shim to match the more
311
+ // strict and common behavior of rejecting regular
312
+ // expressions.
313
+
314
+ // ES5 15.4.4.18
315
+ // http://es5.github.com/#x15.4.4.18
316
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach
317
+
318
+ // Check failure of by-index access of string characters (IE < 9)
319
+ // and failure of `0 in boxedString` (Rhino)
320
+ var boxedString = Object("a"),
321
+ splitString = boxedString[0] != "a" || !(0 in boxedString);
322
+
323
+ if (!Array.prototype.forEach) {
324
+ Array.prototype.forEach = function forEach(fun /*, thisp*/) {
325
+ var object = toObject(this),
326
+ self = splitString && _toString(this) == "[object String]" ?
327
+ this.split("") :
328
+ object,
329
+ thisp = arguments[1],
330
+ i = -1,
331
+ length = self.length >>> 0;
332
+
333
+ // If no callback function or if callback is not a callable function
334
+ if (_toString(fun) != "[object Function]") {
335
+ throw new TypeError(); // TODO message
336
+ }
337
+
338
+ while (++i < length) {
339
+ if (i in self) {
340
+ // Invoke the callback function with call, passing arguments:
341
+ // context, property value, property key, thisArg object
342
+ // context
343
+ fun.call(thisp, self[i], i, object);
344
+ }
345
+ }
346
+ };
347
+ }
348
+
349
+ // ES5 15.4.4.19
350
+ // http://es5.github.com/#x15.4.4.19
351
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
352
+ if (!Array.prototype.map) {
353
+ Array.prototype.map = function map(fun /*, thisp*/) {
354
+ var object = toObject(this),
355
+ self = splitString && _toString(this) == "[object String]" ?
356
+ this.split("") :
357
+ object,
358
+ length = self.length >>> 0,
359
+ result = Array(length),
360
+ thisp = arguments[1];
361
+
362
+ // If no callback function or if callback is not a callable function
363
+ if (_toString(fun) != "[object Function]") {
364
+ throw new TypeError(fun + " is not a function");
365
+ }
366
+
367
+ for (var i = 0; i < length; i++) {
368
+ if (i in self)
369
+ result[i] = fun.call(thisp, self[i], i, object);
370
+ }
371
+ return result;
372
+ };
373
+ }
374
+
375
+ // ES5 15.4.4.20
376
+ // http://es5.github.com/#x15.4.4.20
377
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
378
+ if (!Array.prototype.filter) {
379
+ Array.prototype.filter = function filter(fun /*, thisp */) {
380
+ var object = toObject(this),
381
+ self = splitString && _toString(this) == "[object String]" ?
382
+ this.split("") :
383
+ object,
384
+ length = self.length >>> 0,
385
+ result = [],
386
+ value,
387
+ thisp = arguments[1];
388
+
389
+ // If no callback function or if callback is not a callable function
390
+ if (_toString(fun) != "[object Function]") {
391
+ throw new TypeError(fun + " is not a function");
392
+ }
393
+
394
+ for (var i = 0; i < length; i++) {
395
+ if (i in self) {
396
+ value = self[i];
397
+ if (fun.call(thisp, value, i, object)) {
398
+ result.push(value);
399
+ }
400
+ }
401
+ }
402
+ return result;
403
+ };
404
+ }
405
+
406
+ // ES5 15.4.4.16
407
+ // http://es5.github.com/#x15.4.4.16
408
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every
409
+ if (!Array.prototype.every) {
410
+ Array.prototype.every = function every(fun /*, thisp */) {
411
+ var object = toObject(this),
412
+ self = splitString && _toString(this) == "[object String]" ?
413
+ this.split("") :
414
+ object,
415
+ length = self.length >>> 0,
416
+ thisp = arguments[1];
417
+
418
+ // If no callback function or if callback is not a callable function
419
+ if (_toString(fun) != "[object Function]") {
420
+ throw new TypeError(fun + " is not a function");
421
+ }
422
+
423
+ for (var i = 0; i < length; i++) {
424
+ if (i in self && !fun.call(thisp, self[i], i, object)) {
425
+ return false;
426
+ }
427
+ }
428
+ return true;
429
+ };
430
+ }
431
+
432
+ // ES5 15.4.4.17
433
+ // http://es5.github.com/#x15.4.4.17
434
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
435
+ if (!Array.prototype.some) {
436
+ Array.prototype.some = function some(fun /*, thisp */) {
437
+ var object = toObject(this),
438
+ self = splitString && _toString(this) == "[object String]" ?
439
+ this.split("") :
440
+ object,
441
+ length = self.length >>> 0,
442
+ thisp = arguments[1];
443
+
444
+ // If no callback function or if callback is not a callable function
445
+ if (_toString(fun) != "[object Function]") {
446
+ throw new TypeError(fun + " is not a function");
447
+ }
448
+
449
+ for (var i = 0; i < length; i++) {
450
+ if (i in self && fun.call(thisp, self[i], i, object)) {
451
+ return true;
452
+ }
453
+ }
454
+ return false;
455
+ };
456
+ }
457
+
458
+ // ES5 15.4.4.21
459
+ // http://es5.github.com/#x15.4.4.21
460
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
461
+ if (!Array.prototype.reduce) {
462
+ Array.prototype.reduce = function reduce(fun /*, initial*/) {
463
+ var object = toObject(this),
464
+ self = splitString && _toString(this) == "[object String]" ?
465
+ this.split("") :
466
+ object,
467
+ length = self.length >>> 0;
468
+
469
+ // If no callback function or if callback is not a callable function
470
+ if (_toString(fun) != "[object Function]") {
471
+ throw new TypeError(fun + " is not a function");
472
+ }
473
+
474
+ // no value to return if no initial value and an empty array
475
+ if (!length && arguments.length == 1) {
476
+ throw new TypeError("reduce of empty array with no initial value");
477
+ }
478
+
479
+ var i = 0;
480
+ var result;
481
+ if (arguments.length >= 2) {
482
+ result = arguments[1];
483
+ } else {
484
+ do {
485
+ if (i in self) {
486
+ result = self[i++];
487
+ break;
488
+ }
489
+
490
+ // if array contains no values, no initial value to return
491
+ if (++i >= length) {
492
+ throw new TypeError("reduce of empty array with no initial value");
493
+ }
494
+ } while (true);
495
+ }
496
+
497
+ for (; i < length; i++) {
498
+ if (i in self) {
499
+ result = fun.call(void 0, result, self[i], i, object);
500
+ }
501
+ }
502
+
503
+ return result;
504
+ };
505
+ }
506
+
507
+ // ES5 15.4.4.22
508
+ // http://es5.github.com/#x15.4.4.22
509
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
510
+ if (!Array.prototype.reduceRight) {
511
+ Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
512
+ var object = toObject(this),
513
+ self = splitString && _toString(this) == "[object String]" ?
514
+ this.split("") :
515
+ object,
516
+ length = self.length >>> 0;
517
+
518
+ // If no callback function or if callback is not a callable function
519
+ if (_toString(fun) != "[object Function]") {
520
+ throw new TypeError(fun + " is not a function");
521
+ }
522
+
523
+ // no value to return if no initial value, empty array
524
+ if (!length && arguments.length == 1) {
525
+ throw new TypeError("reduceRight of empty array with no initial value");
526
+ }
527
+
528
+ var result, i = length - 1;
529
+ if (arguments.length >= 2) {
530
+ result = arguments[1];
531
+ } else {
532
+ do {
533
+ if (i in self) {
534
+ result = self[i--];
535
+ break;
536
+ }
537
+
538
+ // if array contains no values, no initial value to return
539
+ if (--i < 0) {
540
+ throw new TypeError("reduceRight of empty array with no initial value");
541
+ }
542
+ } while (true);
543
+ }
544
+
545
+ if (i < 0) {
546
+ return result;
547
+ }
548
+
549
+ do {
550
+ if (i in this) {
551
+ result = fun.call(void 0, result, self[i], i, object);
552
+ }
553
+ } while (i--);
554
+
555
+ return result;
556
+ };
557
+ }
558
+
559
+ // ES5 15.4.4.14
560
+ // http://es5.github.com/#x15.4.4.14
561
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
562
+ if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
563
+ Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
564
+ var self = splitString && _toString(this) == "[object String]" ?
565
+ this.split("") :
566
+ toObject(this),
567
+ length = self.length >>> 0;
568
+
569
+ if (!length) {
570
+ return -1;
571
+ }
572
+
573
+ var i = 0;
574
+ if (arguments.length > 1) {
575
+ i = toInteger(arguments[1]);
576
+ }
577
+
578
+ // handle negative indices
579
+ i = i >= 0 ? i : Math.max(0, length + i);
580
+ for (; i < length; i++) {
581
+ if (i in self && self[i] === sought) {
582
+ return i;
583
+ }
584
+ }
585
+ return -1;
586
+ };
587
+ }
588
+
589
+ // ES5 15.4.4.15
590
+ // http://es5.github.com/#x15.4.4.15
591
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
592
+ if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
593
+ Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
594
+ var self = splitString && _toString(this) == "[object String]" ?
595
+ this.split("") :
596
+ toObject(this),
597
+ length = self.length >>> 0;
598
+
599
+ if (!length) {
600
+ return -1;
601
+ }
602
+ var i = length - 1;
603
+ if (arguments.length > 1) {
604
+ i = Math.min(i, toInteger(arguments[1]));
605
+ }
606
+ // handle negative indices
607
+ i = i >= 0 ? i : length - Math.abs(i);
608
+ for (; i >= 0; i--) {
609
+ if (i in self && sought === self[i]) {
610
+ return i;
611
+ }
612
+ }
613
+ return -1;
614
+ };
615
+ }
616
+
617
+ //
618
+ // Object
619
+ // ======
620
+ //
621
+
622
+ // ES5 15.2.3.14
623
+ // http://es5.github.com/#x15.2.3.14
624
+ if (!Object.keys) {
625
+ // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
626
+ var hasDontEnumBug = true,
627
+ dontEnums = [
628
+ "toString",
629
+ "toLocaleString",
630
+ "valueOf",
631
+ "hasOwnProperty",
632
+ "isPrototypeOf",
633
+ "propertyIsEnumerable",
634
+ "constructor"
635
+ ],
636
+ dontEnumsLength = dontEnums.length;
637
+
638
+ for (var key in {"toString": null}) {
639
+ hasDontEnumBug = false;
640
+ }
641
+
642
+ Object.keys = function keys(object) {
643
+
644
+ if (
645
+ (typeof object != "object" && typeof object != "function") ||
646
+ object === null
647
+ ) {
648
+ throw new TypeError("Object.keys called on a non-object");
649
+ }
650
+
651
+ var keys = [];
652
+ for (var name in object) {
653
+ if (owns(object, name)) {
654
+ keys.push(name);
655
+ }
656
+ }
657
+
658
+ if (hasDontEnumBug) {
659
+ for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
660
+ var dontEnum = dontEnums[i];
661
+ if (owns(object, dontEnum)) {
662
+ keys.push(dontEnum);
663
+ }
664
+ }
665
+ }
666
+ return keys;
667
+ };
668
+
669
+ }
670
+
671
+ //
672
+ // Date
673
+ // ====
674
+ //
675
+
676
+ // ES5 15.9.5.43
677
+ // http://es5.github.com/#x15.9.5.43
678
+ // This function returns a String value represent the instance in time
679
+ // represented by this Date object. The format of the String is the Date Time
680
+ // string format defined in 15.9.1.15. All fields are present in the String.
681
+ // The time zone is always UTC, denoted by the suffix Z. If the time value of
682
+ // this object is not a finite Number a RangeError exception is thrown.
683
+ var negativeDate = -62198755200000,
684
+ negativeYearString = "-000001";
685
+ if (
686
+ !Date.prototype.toISOString ||
687
+ (new Date(negativeDate).toISOString().indexOf(negativeYearString) === -1)
688
+ ) {
689
+ Date.prototype.toISOString = function toISOString() {
690
+ var result, length, value, year, month;
691
+ if (!isFinite(this)) {
692
+ throw new RangeError("Date.prototype.toISOString called on non-finite value.");
693
+ }
694
+
695
+ year = this.getUTCFullYear();
696
+
697
+ month = this.getUTCMonth();
698
+ // see https://github.com/kriskowal/es5-shim/issues/111
699
+ year += Math.floor(month / 12);
700
+ month = (month % 12 + 12) % 12;
701
+
702
+ // the date time string format is specified in 15.9.1.15.
703
+ result = [month + 1, this.getUTCDate(),
704
+ this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
705
+ year = (
706
+ (year < 0 ? "-" : (year > 9999 ? "+" : "")) +
707
+ ("00000" + Math.abs(year))
708
+ .slice(0 <= year && year <= 9999 ? -4 : -6)
709
+ );
710
+
711
+ length = result.length;
712
+ while (length--) {
713
+ value = result[length];
714
+ // pad months, days, hours, minutes, and seconds to have two
715
+ // digits.
716
+ if (value < 10) {
717
+ result[length] = "0" + value;
718
+ }
719
+ }
720
+ // pad milliseconds to have three digits.
721
+ return (
722
+ year + "-" + result.slice(0, 2).join("-") +
723
+ "T" + result.slice(2).join(":") + "." +
724
+ ("000" + this.getUTCMilliseconds()).slice(-3) + "Z"
725
+ );
726
+ };
727
+ }
728
+
729
+
730
+ // ES5 15.9.5.44
731
+ // http://es5.github.com/#x15.9.5.44
732
+ // This function provides a String representation of a Date object for use by
733
+ // JSON.stringify (15.12.3).
734
+ var dateToJSONIsSupported = false;
735
+ try {
736
+ dateToJSONIsSupported = (
737
+ Date.prototype.toJSON &&
738
+ new Date(NaN).toJSON() === null &&
739
+ new Date(negativeDate).toJSON().indexOf(negativeYearString) !== -1 &&
740
+ Date.prototype.toJSON.call({ // generic
741
+ toISOString: function () {
742
+ return true;
743
+ }
744
+ })
745
+ );
746
+ } catch (e) {
747
+ }
748
+ if (!dateToJSONIsSupported) {
749
+ Date.prototype.toJSON = function toJSON(key) {
750
+ // When the toJSON method is called with argument key, the following
751
+ // steps are taken:
752
+
753
+ // 1. Let O be the result of calling ToObject, giving it the this
754
+ // value as its argument.
755
+ // 2. Let tv be toPrimitive(O, hint Number).
756
+ var o = Object(this),
757
+ tv = toPrimitive(o),
758
+ toISO;
759
+ // 3. If tv is a Number and is not finite, return null.
760
+ if (typeof tv === "number" && !isFinite(tv)) {
761
+ return null;
762
+ }
763
+ // 4. Let toISO be the result of calling the [[Get]] internal method of
764
+ // O with argument "toISOString".
765
+ toISO = o.toISOString;
766
+ // 5. If IsCallable(toISO) is false, throw a TypeError exception.
767
+ if (typeof toISO != "function") {
768
+ throw new TypeError("toISOString property is not callable");
769
+ }
770
+ // 6. Return the result of calling the [[Call]] internal method of
771
+ // toISO with O as the this value and an empty argument list.
772
+ return toISO.call(o);
773
+
774
+ // NOTE 1 The argument is ignored.
775
+
776
+ // NOTE 2 The toJSON function is intentionally generic; it does not
777
+ // require that its this value be a Date object. Therefore, it can be
778
+ // transferred to other kinds of objects for use as a method. However,
779
+ // it does require that any such object have a toISOString method. An
780
+ // object is free to use the argument key to filter its
781
+ // stringification.
782
+ };
783
+ }
784
+
785
+ // ES5 15.9.4.2
786
+ // http://es5.github.com/#x15.9.4.2
787
+ // based on work shared by Daniel Friesen (dantman)
788
+ // http://gist.github.com/303249
789
+ if (!Date.parse || "Date.parse is buggy") {
790
+ // XXX global assignment won't work in embeddings that use
791
+ // an alternate object for the context.
792
+ Date = (function(NativeDate) {
793
+
794
+ // Date.length === 7
795
+ function Date(Y, M, D, h, m, s, ms) {
796
+ var length = arguments.length;
797
+ if (this instanceof NativeDate) {
798
+ var date = length == 1 && String(Y) === Y ? // isString(Y)
799
+ // We explicitly pass it through parse:
800
+ new NativeDate(Date.parse(Y)) :
801
+ // We have to manually make calls depending on argument
802
+ // length here
803
+ length >= 7 ? new NativeDate(Y, M, D, h, m, s, ms) :
804
+ length >= 6 ? new NativeDate(Y, M, D, h, m, s) :
805
+ length >= 5 ? new NativeDate(Y, M, D, h, m) :
806
+ length >= 4 ? new NativeDate(Y, M, D, h) :
807
+ length >= 3 ? new NativeDate(Y, M, D) :
808
+ length >= 2 ? new NativeDate(Y, M) :
809
+ length >= 1 ? new NativeDate(Y) :
810
+ new NativeDate();
811
+ // Prevent mixups with unfixed Date object
812
+ date.constructor = Date;
813
+ return date;
814
+ }
815
+ return NativeDate.apply(this, arguments);
816
+ };
817
+
818
+ // 15.9.1.15 Date Time String Format.
819
+ var isoDateExpression = new RegExp("^" +
820
+ "(\\d{4}|[\+\-]\\d{6})" + // four-digit year capture or sign +
821
+ // 6-digit extended year
822
+ "(?:-(\\d{2})" + // optional month capture
823
+ "(?:-(\\d{2})" + // optional day capture
824
+ "(?:" + // capture hours:minutes:seconds.milliseconds
825
+ "T(\\d{2})" + // hours capture
826
+ ":(\\d{2})" + // minutes capture
827
+ "(?:" + // optional :seconds.milliseconds
828
+ ":(\\d{2})" + // seconds capture
829
+ "(?:(\\.\\d{1,}))?" + // milliseconds capture
830
+ ")?" +
831
+ "(" + // capture UTC offset component
832
+ "Z|" + // UTC capture
833
+ "(?:" + // offset specifier +/-hours:minutes
834
+ "([-+])" + // sign capture
835
+ "(\\d{2})" + // hours offset capture
836
+ ":(\\d{2})" + // minutes offset capture
837
+ ")" +
838
+ ")?)?)?)?" +
839
+ "$");
840
+
841
+ var months = [
842
+ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
843
+ ];
844
+
845
+ function dayFromMonth(year, month) {
846
+ var t = month > 1 ? 1 : 0;
847
+ return (
848
+ months[month] +
849
+ Math.floor((year - 1969 + t) / 4) -
850
+ Math.floor((year - 1901 + t) / 100) +
851
+ Math.floor((year - 1601 + t) / 400) +
852
+ 365 * (year - 1970)
853
+ );
854
+ }
855
+
856
+ // Copy any custom methods a 3rd party library may have added
857
+ for (var key in NativeDate) {
858
+ Date[key] = NativeDate[key];
859
+ }
860
+
861
+ // Copy "native" methods explicitly; they may be non-enumerable
862
+ Date.now = NativeDate.now;
863
+ Date.UTC = NativeDate.UTC;
864
+ Date.prototype = NativeDate.prototype;
865
+ Date.prototype.constructor = Date;
866
+
867
+ // Upgrade Date.parse to handle simplified ISO 8601 strings
868
+ Date.parse = function parse(string) {
869
+ var match = isoDateExpression.exec(string);
870
+ if (match) {
871
+ // parse months, days, hours, minutes, seconds, and milliseconds
872
+ // provide default values if necessary
873
+ // parse the UTC offset component
874
+ var year = Number(match[1]),
875
+ month = Number(match[2] || 1) - 1,
876
+ day = Number(match[3] || 1) - 1,
877
+ hour = Number(match[4] || 0),
878
+ minute = Number(match[5] || 0),
879
+ second = Number(match[6] || 0),
880
+ millisecond = Math.floor(Number(match[7] || 0) * 1000),
881
+ // When time zone is missed, local offset should be used
882
+ // (ES 5.1 bug)
883
+ // see https://bugs.ecmascript.org/show_bug.cgi?id=112
884
+ offset = !match[4] || match[8] ?
885
+ 0 : Number(new NativeDate(1970, 0)),
886
+ signOffset = match[9] === "-" ? 1 : -1,
887
+ hourOffset = Number(match[10] || 0),
888
+ minuteOffset = Number(match[11] || 0),
889
+ result;
890
+ if (
891
+ hour < (
892
+ minute > 0 || second > 0 || millisecond > 0 ?
893
+ 24 : 25
894
+ ) &&
895
+ minute < 60 && second < 60 && millisecond < 1000 &&
896
+ month > -1 && month < 12 && hourOffset < 24 &&
897
+ minuteOffset < 60 && // detect invalid offsets
898
+ day > -1 &&
899
+ day < (
900
+ dayFromMonth(year, month + 1) -
901
+ dayFromMonth(year, month)
902
+ )
903
+ ) {
904
+ result = (
905
+ (dayFromMonth(year, month) + day) * 24 +
906
+ hour +
907
+ hourOffset * signOffset
908
+ ) * 60;
909
+ result = (
910
+ (result + minute + minuteOffset * signOffset) * 60 +
911
+ second
912
+ ) * 1000 + millisecond + offset;
913
+ if (-8.64e15 <= result && result <= 8.64e15) {
914
+ return result;
915
+ }
916
+ }
917
+ return NaN;
918
+ }
919
+ return NativeDate.parse.apply(this, arguments);
920
+ };
921
+
922
+ return Date;
923
+ })(Date);
924
+ }
925
+
926
+ // ES5 15.9.4.4
927
+ // http://es5.github.com/#x15.9.4.4
928
+ if (!Date.now) {
929
+ Date.now = function now() {
930
+ return new Date().getTime();
931
+ };
932
+ }
933
+
934
+
935
+ //
936
+ // Number
937
+ // ======
938
+ //
939
+
940
+ // ES5.1 15.7.4.5
941
+ // http://es5.github.com/#x15.7.4.5
942
+ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || (1000000000000000128).toFixed(0) !== "1000000000000000128") {
943
+ // Hide these variables and functions
944
+ (function () {
945
+ var base, size, data, i;
946
+
947
+ base = 1e7;
948
+ size = 6;
949
+ data = [0, 0, 0, 0, 0, 0];
950
+
951
+ function multiply(n, c) {
952
+ var i = -1;
953
+ while (++i < size) {
954
+ c += n * data[i];
955
+ data[i] = c % base;
956
+ c = Math.floor(c / base);
957
+ }
958
+ }
959
+
960
+ function divide(n) {
961
+ var i = size, c = 0;
962
+ while (--i >= 0) {
963
+ c += data[i];
964
+ data[i] = Math.floor(c / n);
965
+ c = (c % n) * base;
966
+ }
967
+ }
968
+
969
+ function toString() {
970
+ var i = size;
971
+ var s = '';
972
+ while (--i >= 0) {
973
+ if (s !== '' || i === 0 || data[i] !== 0) {
974
+ var t = String(data[i]);
975
+ if (s === '') {
976
+ s = t;
977
+ } else {
978
+ s += '0000000'.slice(0, 7 - t.length) + t;
979
+ }
980
+ }
981
+ }
982
+ return s;
983
+ }
984
+
985
+ function pow(x, n, acc) {
986
+ return (n === 0 ? acc : (n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc)));
987
+ }
988
+
989
+ function log(x) {
990
+ var n = 0;
991
+ while (x >= 4096) {
992
+ n += 12;
993
+ x /= 4096;
994
+ }
995
+ while (x >= 2) {
996
+ n += 1;
997
+ x /= 2;
998
+ }
999
+ return n;
1000
+ }
1001
+
1002
+ Number.prototype.toFixed = function (fractionDigits) {
1003
+ var f, x, s, m, e, z, j, k;
1004
+
1005
+ // Test for NaN and round fractionDigits down
1006
+ f = Number(fractionDigits);
1007
+ f = f !== f ? 0 : Math.floor(f);
1008
+
1009
+ if (f < 0 || f > 20) {
1010
+ throw new RangeError("Number.toFixed called with invalid number of decimals");
1011
+ }
1012
+
1013
+ x = Number(this);
1014
+
1015
+ // Test for NaN
1016
+ if (x !== x) {
1017
+ return "NaN";
1018
+ }
1019
+
1020
+ // If it is too big or small, return the string value of the number
1021
+ if (x <= -1e21 || x >= 1e21) {
1022
+ return String(x);
1023
+ }
1024
+
1025
+ s = "";
1026
+
1027
+ if (x < 0) {
1028
+ s = "-";
1029
+ x = -x;
1030
+ }
1031
+
1032
+ m = "0";
1033
+
1034
+ if (x > 1e-21) {
1035
+ // 1e-21 < x < 1e21
1036
+ // -70 < log2(x) < 70
1037
+ e = log(x * pow(2, 69, 1)) - 69;
1038
+ z = (e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1));
1039
+ z *= 0x10000000000000; // Math.pow(2, 52);
1040
+ e = 52 - e;
1041
+
1042
+ // -18 < e < 122
1043
+ // x = z / 2 ^ e
1044
+ if (e > 0) {
1045
+ multiply(0, z);
1046
+ j = f;
1047
+
1048
+ while (j >= 7) {
1049
+ multiply(1e7, 0);
1050
+ j -= 7;
1051
+ }
1052
+
1053
+ multiply(pow(10, j, 1), 0);
1054
+ j = e - 1;
1055
+
1056
+ while (j >= 23) {
1057
+ divide(1 << 23);
1058
+ j -= 23;
1059
+ }
1060
+
1061
+ divide(1 << j);
1062
+ multiply(1, 1);
1063
+ divide(2);
1064
+ m = toString();
1065
+ } else {
1066
+ multiply(0, z);
1067
+ multiply(1 << (-e), 0);
1068
+ m = toString() + '0.00000000000000000000'.slice(2, 2 + f);
1069
+ }
1070
+ }
1071
+
1072
+ if (f > 0) {
1073
+ k = m.length;
1074
+
1075
+ if (k <= f) {
1076
+ m = s + '0.0000000000000000000'.slice(0, f - k + 2) + m;
1077
+ } else {
1078
+ m = s + m.slice(0, k - f) + '.' + m.slice(k - f);
1079
+ }
1080
+ } else {
1081
+ m = s + m;
1082
+ }
1083
+
1084
+ return m;
1085
+ }
1086
+ }());
1087
+ }
1088
+
1089
+
1090
+ //
1091
+ // String
1092
+ // ======
1093
+ //
1094
+
1095
+
1096
+ // ES5 15.5.4.14
1097
+ // http://es5.github.com/#x15.5.4.14
1098
+
1099
+ // [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers]
1100
+ // Many browsers do not split properly with regular expressions or they
1101
+ // do not perform the split correctly under obscure conditions.
1102
+ // See http://blog.stevenlevithan.com/archives/cross-browser-split
1103
+ // I've tested in many browsers and this seems to cover the deviant ones:
1104
+ // 'ab'.split(/(?:ab)*/) should be ["", ""], not [""]
1105
+ // '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""]
1106
+ // 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not
1107
+ // [undefined, "t", undefined, "e", ...]
1108
+ // ''.split(/.?/) should be [], not [""]
1109
+ // '.'.split(/()()/) should be ["."], not ["", "", "."]
1110
+
1111
+ var string_split = String.prototype.split;
1112
+ if (
1113
+ 'ab'.split(/(?:ab)*/).length !== 2 ||
1114
+ '.'.split(/(.?)(.?)/).length !== 4 ||
1115
+ 'tesst'.split(/(s)*/)[1] === "t" ||
1116
+ ''.split(/.?/).length === 0 ||
1117
+ '.'.split(/()()/).length > 1
1118
+ ) {
1119
+ (function () {
1120
+ var compliantExecNpcg = /()??/.exec("")[1] === void 0; // NPCG: nonparticipating capturing group
1121
+
1122
+ String.prototype.split = function (separator, limit) {
1123
+ var string = this;
1124
+ if (separator === void 0 && limit === 0)
1125
+ return [];
1126
+
1127
+ // If `separator` is not a regex, use native split
1128
+ if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
1129
+ return string_split.apply(this, arguments);
1130
+ }
1131
+
1132
+ var output = [],
1133
+ flags = (separator.ignoreCase ? "i" : "") +
1134
+ (separator.multiline ? "m" : "") +
1135
+ (separator.extended ? "x" : "") + // Proposed for ES6
1136
+ (separator.sticky ? "y" : ""), // Firefox 3+
1137
+ lastLastIndex = 0,
1138
+ // Make `global` and avoid `lastIndex` issues by working with a copy
1139
+ separator = new RegExp(separator.source, flags + "g"),
1140
+ separator2, match, lastIndex, lastLength;
1141
+ string += ""; // Type-convert
1142
+ if (!compliantExecNpcg) {
1143
+ // Doesn't need flags gy, but they don't hurt
1144
+ separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
1145
+ }
1146
+ /* Values for `limit`, per the spec:
1147
+ * If undefined: 4294967295 // Math.pow(2, 32) - 1
1148
+ * If 0, Infinity, or NaN: 0
1149
+ * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
1150
+ * If negative number: 4294967296 - Math.floor(Math.abs(limit))
1151
+ * If other: Type-convert, then use the above rules
1152
+ */
1153
+ limit = limit === void 0 ?
1154
+ -1 >>> 0 : // Math.pow(2, 32) - 1
1155
+ limit >>> 0; // ToUint32(limit)
1156
+ while (match = separator.exec(string)) {
1157
+ // `separator.lastIndex` is not reliable cross-browser
1158
+ lastIndex = match.index + match[0].length;
1159
+ if (lastIndex > lastLastIndex) {
1160
+ output.push(string.slice(lastLastIndex, match.index));
1161
+ // Fix browsers whose `exec` methods don't consistently return `undefined` for
1162
+ // nonparticipating capturing groups
1163
+ if (!compliantExecNpcg && match.length > 1) {
1164
+ match[0].replace(separator2, function () {
1165
+ for (var i = 1; i < arguments.length - 2; i++) {
1166
+ if (arguments[i] === void 0) {
1167
+ match[i] = void 0;
1168
+ }
1169
+ }
1170
+ });
1171
+ }
1172
+ if (match.length > 1 && match.index < string.length) {
1173
+ Array.prototype.push.apply(output, match.slice(1));
1174
+ }
1175
+ lastLength = match[0].length;
1176
+ lastLastIndex = lastIndex;
1177
+ if (output.length >= limit) {
1178
+ break;
1179
+ }
1180
+ }
1181
+ if (separator.lastIndex === match.index) {
1182
+ separator.lastIndex++; // Avoid an infinite loop
1183
+ }
1184
+ }
1185
+ if (lastLastIndex === string.length) {
1186
+ if (lastLength || !separator.test("")) {
1187
+ output.push("");
1188
+ }
1189
+ } else {
1190
+ output.push(string.slice(lastLastIndex));
1191
+ }
1192
+ return output.length > limit ? output.slice(0, limit) : output;
1193
+ };
1194
+ }());
1195
+
1196
+ // [bugfix, chrome]
1197
+ // If separator is undefined, then the result array contains just one String,
1198
+ // which is the this value (converted to a String). If limit is not undefined,
1199
+ // then the output array is truncated so that it contains no more than limit
1200
+ // elements.
1201
+ // "0".split(undefined, 0) -> []
1202
+ } else if ("0".split(void 0, 0).length) {
1203
+ String.prototype.split = function(separator, limit) {
1204
+ if (separator === void 0 && limit === 0) return [];
1205
+ return string_split.apply(this, arguments);
1206
+ }
1207
+ }
1208
+
1209
+
1210
+ // ECMA-262, 3rd B.2.3
1211
+ // Note an ECMAScript standart, although ECMAScript 3rd Edition has a
1212
+ // non-normative section suggesting uniform semantics and it should be
1213
+ // normalized across all browsers
1214
+ // [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
1215
+ if("".substr && "0b".substr(-1) !== "b") {
1216
+ var string_substr = String.prototype.substr;
1217
+ /**
1218
+ * Get the substring of a string
1219
+ * @param {integer} start where to start the substring
1220
+ * @param {integer} length how many characters to return
1221
+ * @return {string}
1222
+ */
1223
+ String.prototype.substr = function(start, length) {
1224
+ return string_substr.call(
1225
+ this,
1226
+ start < 0 ? ((start = this.length + start) < 0 ? 0 : start) : start,
1227
+ length
1228
+ );
1229
+ }
1230
+ }
1231
+
1232
+ // ES5 15.5.4.20
1233
+ // http://es5.github.com/#x15.5.4.20
1234
+ var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
1235
+ "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
1236
+ "\u2029\uFEFF";
1237
+ if (!String.prototype.trim || ws.trim()) {
1238
+ // http://blog.stevenlevithan.com/archives/faster-trim-javascript
1239
+ // http://perfectionkills.com/whitespace-deviations/
1240
+ ws = "[" + ws + "]";
1241
+ var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
1242
+ trimEndRegexp = new RegExp(ws + ws + "*$");
1243
+ String.prototype.trim = function trim() {
1244
+ if (this === void 0 || this === null) {
1245
+ throw new TypeError("can't convert "+this+" to object");
1246
+ }
1247
+ return String(this)
1248
+ .replace(trimBeginRegexp, "")
1249
+ .replace(trimEndRegexp, "");
1250
+ };
1251
+ }
1252
+
1253
+ //
1254
+ // Util
1255
+ // ======
1256
+ //
1257
+
1258
+ // ES5 9.4
1259
+ // http://es5.github.com/#x9.4
1260
+ // http://jsperf.com/to-integer
1261
+
1262
+ function toInteger(n) {
1263
+ n = +n;
1264
+ if (n !== n) { // isNaN
1265
+ n = 0;
1266
+ } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
1267
+ n = (n > 0 || -1) * Math.floor(Math.abs(n));
1268
+ }
1269
+ return n;
1270
+ }
1271
+
1272
+ function isPrimitive(input) {
1273
+ var type = typeof input;
1274
+ return (
1275
+ input === null ||
1276
+ type === "undefined" ||
1277
+ type === "boolean" ||
1278
+ type === "number" ||
1279
+ type === "string"
1280
+ );
1281
+ }
1282
+
1283
+ function toPrimitive(input) {
1284
+ var val, valueOf, toString;
1285
+ if (isPrimitive(input)) {
1286
+ return input;
1287
+ }
1288
+ valueOf = input.valueOf;
1289
+ if (typeof valueOf === "function") {
1290
+ val = valueOf.call(input);
1291
+ if (isPrimitive(val)) {
1292
+ return val;
1293
+ }
1294
+ }
1295
+ toString = input.toString;
1296
+ if (typeof toString === "function") {
1297
+ val = toString.call(input);
1298
+ if (isPrimitive(val)) {
1299
+ return val;
1300
+ }
1301
+ }
1302
+ throw new TypeError();
1303
+ }
1304
+
1305
+ // ES5 9.9
1306
+ // http://es5.github.com/#x9.9
1307
+ var toObject = function (o) {
1308
+ if (o == null) { // this matches both null and undefined
1309
+ throw new TypeError("can't convert "+o+" to object");
1310
+ }
1311
+ return Object(o);
1312
+ };
1313
+
1314
+ });