blocky 0.0.11 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (416) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -41
  3. data/app/helpers/blocky_helper.rb +31 -13
  4. data/app/models/blocky/content_block.rb +15 -19
  5. data/db/migrate/20140326210255_create_blocky_content_blocks.rb +2 -3
  6. data/lib/blocky.rb +2 -6
  7. data/lib/blocky/admin/content_block.rb +50 -0
  8. data/lib/blocky/engine.rb +9 -9
  9. data/lib/blocky/version.rb +1 -1
  10. data/lib/generators/blocky/install_generator.rb +5 -29
  11. metadata +6 -977
  12. data/app/assets/javascripts/blocky/application.js +0 -21
  13. data/app/assets/javascripts/blocky/flash_messages.js +0 -20
  14. data/app/assets/stylesheets/blocky/_imports.scss +0 -3
  15. data/app/assets/stylesheets/blocky/_variables.scss +0 -37
  16. data/app/assets/stylesheets/blocky/all.scss +0 -20
  17. data/app/assets/stylesheets/blocky/application.css.scss +0 -3
  18. data/app/assets/stylesheets/blocky/application/content_blocks/edit.scss +0 -13
  19. data/app/assets/stylesheets/blocky/application/content_blocks/index.scss +0 -81
  20. data/app/assets/stylesheets/blocky/application/layout.scss +0 -30
  21. data/app/assets/stylesheets/blocky/shared/buttons.scss +0 -119
  22. data/app/assets/stylesheets/blocky/shared/flash_messages.scss +0 -28
  23. data/app/assets/stylesheets/blocky/shared/typography/body.scss +0 -91
  24. data/app/assets/stylesheets/blocky/shared/typography/forms.scss +0 -81
  25. data/app/assets/stylesheets/blocky/shared/typography/headings.scss +0 -38
  26. data/app/assets/stylesheets/blocky/shared/typography/lists.scss +0 -22
  27. data/app/controllers/blocky/application_controller.rb +0 -7
  28. data/app/controllers/blocky/content_blocks_controller.rb +0 -64
  29. data/app/controllers/blocky/images_controller.rb +0 -43
  30. data/app/controllers/concerns/blocky/auth.rb +0 -53
  31. data/app/helpers/blocky/application_helper.rb +0 -26
  32. data/app/models/blocky/ability.rb +0 -11
  33. data/app/views/blocky/content_blocks/_content_block.html.erb +0 -1
  34. data/app/views/blocky/content_blocks/edit.html.erb +0 -62
  35. data/app/views/blocky/content_blocks/index.html.erb +0 -81
  36. data/app/views/blocky/content_blocks/index.json.jbuilder +0 -10
  37. data/app/views/blocky/content_blocks/show.json.jbuilder +0 -10
  38. data/app/views/layouts/blocky/_flash_messages.html.erb +0 -13
  39. data/app/views/layouts/blocky/application.html.erb +0 -20
  40. data/config/jshint.json +0 -28
  41. data/config/routes.rb +0 -5
  42. data/db/migrate/20140520212037_add_page_path_to_content_blocks.rb +0 -7
  43. data/spec/dummy/Procfile +0 -1
  44. data/spec/dummy/README.rdoc +0 -28
  45. data/spec/dummy/Rakefile +0 -6
  46. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  47. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  48. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  49. data/spec/dummy/app/controllers/static_pages_controller.rb +0 -7
  50. data/spec/dummy/app/helpers/application_helper.rb +0 -3
  51. data/spec/dummy/app/models/blocky/ability.rb +0 -9
  52. data/spec/dummy/app/views/layouts/application.html.erb +0 -25
  53. data/spec/dummy/app/views/static_pages/contact.html.erb +0 -8
  54. data/spec/dummy/app/views/static_pages/home.html.erb +0 -7
  55. data/spec/dummy/bin/bundle +0 -3
  56. data/spec/dummy/bin/rails +0 -4
  57. data/spec/dummy/bin/rake +0 -4
  58. data/spec/dummy/config.ru +0 -4
  59. data/spec/dummy/config/application.rb +0 -23
  60. data/spec/dummy/config/boot.rb +0 -5
  61. data/spec/dummy/config/database.yml +0 -25
  62. data/spec/dummy/config/environment.rb +0 -5
  63. data/spec/dummy/config/environments/development.rb +0 -29
  64. data/spec/dummy/config/environments/production.rb +0 -80
  65. data/spec/dummy/config/environments/test.rb +0 -36
  66. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  67. data/spec/dummy/config/initializers/blocky.rb +0 -4
  68. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  69. data/spec/dummy/config/initializers/inflections.rb +0 -16
  70. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  71. data/spec/dummy/config/initializers/secret_token.rb +0 -12
  72. data/spec/dummy/config/initializers/session_store.rb +0 -3
  73. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  74. data/spec/dummy/config/locales/en.yml +0 -23
  75. data/spec/dummy/config/routes.rb +0 -5
  76. data/spec/dummy/db/development.sqlite3 +0 -0
  77. data/spec/dummy/db/migrate/20140326211453_create_blocky_content_blocks.blocky.rb +0 -13
  78. data/spec/dummy/db/migrate/20140521143840_add_page_path_to_content_blocks.blocky.rb +0 -8
  79. data/spec/dummy/db/schema.rb +0 -24
  80. data/spec/dummy/db/test.sqlite3 +0 -0
  81. data/spec/dummy/log/development.log +0 -16366
  82. data/spec/dummy/log/test.log +0 -151
  83. data/spec/dummy/public/404.html +0 -58
  84. data/spec/dummy/public/422.html +0 -58
  85. data/spec/dummy/public/500.html +0 -57
  86. data/spec/dummy/public/favicon.ico +0 -0
  87. data/spec/dummy/tmp/cache/AE1/4D0/blocky%2Fcontent_blocks%2Fnew +0 -0
  88. data/spec/dummy/tmp/cache/E76/DE0/blocky%2Fcontent_blocks%2F1-20140326211612204255000 +0 -1
  89. data/spec/dummy/tmp/cache/E79/1C0/blocky%2Fcontent_blocks%2F4-20140520200831236730000 +0 -6
  90. data/spec/dummy/tmp/cache/E79/630/blocky%2Fcontent_blocks%2F5-20140326220740803013000 +0 -0
  91. data/spec/dummy/tmp/cache/E7D/2C0/blocky%2Fcontent_blocks%2F2-20140326211803501817000 +0 -1
  92. data/spec/dummy/tmp/cache/E7F/480/blocky%2Fcontent_blocks%2F2-20140326211735204743000 +0 -0
  93. data/spec/dummy/tmp/cache/E82/5D0/blocky%2Fcontent_blocks%2F2-20140522172212942644000 +0 -3
  94. data/spec/dummy/tmp/cache/E83/720/blocky%2Fcontent_blocks%2F3-20140326212218805733000 +0 -0
  95. data/spec/dummy/tmp/cache/E85/4F0/blocky%2Fcontent_blocks%2F1-20140326211503578725000 +0 -0
  96. data/spec/dummy/tmp/cache/E86/7B0/blocky%2Fcontent_blocks%2F4-20140522172300720879000 +0 -6
  97. data/spec/dummy/tmp/cache/E88/650/blocky%2Fcontent_blocks%2F1-20140522172212927549000 +0 -3
  98. data/spec/dummy/tmp/cache/E8A/C50/blocky%2Fcontent_blocks%2F6-20140520152442627674000 +0 -0
  99. data/spec/dummy/tmp/cache/E8C/390/blocky%2Fcontent_blocks%2F9-20140521143916645081000 +0 -3
  100. data/spec/dummy/tmp/cache/E8F/4B0/blocky%2Fcontent_blocks%2F8-20140521143847577033000 +0 -3
  101. data/spec/dummy/tmp/cache/E8F/B50/blocky%2Fcontent_blocks%2F3-20140522172212955589000 +0 -3
  102. data/spec/dummy/tmp/cache/E8F/DF0/blocky%2Fcontent_blocks%2F4-20140522172414829485000 +0 -4
  103. data/spec/dummy/tmp/cache/E8F/EE0/blocky%2Fcontent_blocks%2F4-20140326214706659274000 +0 -0
  104. data/spec/dummy/tmp/cache/E95/020/blocky%2Fcontent_blocks%2F4-20140520170832796695000 +0 -2
  105. data/spec/dummy/tmp/cache/E9C/710/blocky%2Fcontent_blocks%2F7-20140521143847555969000 +0 -3
  106. data/spec/dummy/tmp/cache/EB0/BC0/blocky%2Fcontent_blocks%2F10-20140521145206891062000 +0 -6
  107. data/spec/dummy/tmp/cache/EB7/EC0/blocky%2Fcontent_blocks%2F11-20140521145206908717000 +0 -3
  108. data/spec/dummy/tmp/cache/EBC/5C0/blocky%2Fcontent_blocks%2F13-20140521145258981073000 +0 -3
  109. data/spec/dummy/tmp/cache/EC4/780/blocky%2Fcontent_blocks%2F12-20140521145258965683000 +0 -3
  110. data/spec/dummy/tmp/cache/assets/development/sass/1330522281c54fc4f0f88c06856f0cc8052c25e8/buttons.scssc +0 -0
  111. data/spec/dummy/tmp/cache/assets/development/sass/1330522281c54fc4f0f88c06856f0cc8052c25e8/flash_messages.scssc +0 -0
  112. data/spec/dummy/tmp/cache/assets/development/sass/16328cd177fa77f37d597cddc166b9d61ed7bdc6/_compact.scssc +0 -0
  113. data/spec/dummy/tmp/cache/assets/development/sass/16328cd177fa77f37d597cddc166b9d61ed7bdc6/_flex-grid.scssc +0 -0
  114. data/spec/dummy/tmp/cache/assets/development/sass/16328cd177fa77f37d597cddc166b9d61ed7bdc6/_grid-width.scssc +0 -0
  115. data/spec/dummy/tmp/cache/assets/development/sass/16328cd177fa77f37d597cddc166b9d61ed7bdc6/_linear-gradient.scssc +0 -0
  116. data/spec/dummy/tmp/cache/assets/development/sass/16328cd177fa77f37d597cddc166b9d61ed7bdc6/_modular-scale.scssc +0 -0
  117. data/spec/dummy/tmp/cache/assets/development/sass/16328cd177fa77f37d597cddc166b9d61ed7bdc6/_px-to-em.scssc +0 -0
  118. data/spec/dummy/tmp/cache/assets/development/sass/16328cd177fa77f37d597cddc166b9d61ed7bdc6/_radial-gradient.scssc +0 -0
  119. data/spec/dummy/tmp/cache/assets/development/sass/16328cd177fa77f37d597cddc166b9d61ed7bdc6/_tint-shade.scssc +0 -0
  120. data/spec/dummy/tmp/cache/assets/development/sass/16328cd177fa77f37d597cddc166b9d61ed7bdc6/_transition-property-name.scssc +0 -0
  121. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_bordered-pulled.scssc +0 -0
  122. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_core.scssc +0 -0
  123. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_fixed-width.scssc +0 -0
  124. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_icons.scssc +0 -0
  125. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_larger.scssc +0 -0
  126. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_list.scssc +0 -0
  127. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_mixins.scssc +0 -0
  128. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_path.scssc +0 -0
  129. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_rotated-flipped.scssc +0 -0
  130. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_spinning.scssc +0 -0
  131. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_stacked.scssc +0 -0
  132. data/spec/dummy/tmp/cache/assets/development/sass/2ed2f1a12f96a5966a3f2f4a226be3068f8e609b/_variables.scssc +0 -0
  133. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_fill-parent.scssc +0 -0
  134. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_grid.scssc +0 -0
  135. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_media.scssc +0 -0
  136. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_omega.scssc +0 -0
  137. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_outer-container.scssc +0 -0
  138. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_pad.scssc +0 -0
  139. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_private.scssc +0 -0
  140. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_reset.scssc +0 -0
  141. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_row.scssc +0 -0
  142. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_shift.scssc +0 -0
  143. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_span-columns.scssc +0 -0
  144. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_to-deprecate.scssc +0 -0
  145. data/spec/dummy/tmp/cache/assets/development/sass/3fb34f29991e8a63348b29fade50f1de29147c8f/_visual-grid.scssc +0 -0
  146. data/spec/dummy/tmp/cache/assets/development/sass/45a8d9925ba36450f7e3862c914588ae8720003e/_imports.scssc +0 -0
  147. data/spec/dummy/tmp/cache/assets/development/sass/45a8d9925ba36450f7e3862c914588ae8720003e/_variables.scssc +0 -0
  148. data/spec/dummy/tmp/cache/assets/development/sass/45a8d9925ba36450f7e3862c914588ae8720003e/application.css.scssc +0 -0
  149. data/spec/dummy/tmp/cache/assets/development/sass/4808b00b5a9150b9a854e6877435916328f1da81/_deprecated-webkit-gradient.scssc +0 -0
  150. data/spec/dummy/tmp/cache/assets/development/sass/4808b00b5a9150b9a854e6877435916328f1da81/_gradient-positions-parser.scssc +0 -0
  151. data/spec/dummy/tmp/cache/assets/development/sass/4808b00b5a9150b9a854e6877435916328f1da81/_linear-positions-parser.scssc +0 -0
  152. data/spec/dummy/tmp/cache/assets/development/sass/4808b00b5a9150b9a854e6877435916328f1da81/_radial-arg-parser.scssc +0 -0
  153. data/spec/dummy/tmp/cache/assets/development/sass/4808b00b5a9150b9a854e6877435916328f1da81/_radial-positions-parser.scssc +0 -0
  154. data/spec/dummy/tmp/cache/assets/development/sass/4808b00b5a9150b9a854e6877435916328f1da81/_render-gradients.scssc +0 -0
  155. data/spec/dummy/tmp/cache/assets/development/sass/4808b00b5a9150b9a854e6877435916328f1da81/_shape-size-stripper.scssc +0 -0
  156. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_animation.scssc +0 -0
  157. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_appearance.scssc +0 -0
  158. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_backface-visibility.scssc +0 -0
  159. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_background-image.scssc +0 -0
  160. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_background.scssc +0 -0
  161. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_border-image.scssc +0 -0
  162. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_border-radius.scssc +0 -0
  163. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_box-sizing.scssc +0 -0
  164. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_columns.scssc +0 -0
  165. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_flex-box.scssc +0 -0
  166. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_font-face.scssc +0 -0
  167. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_hidpi-media-query.scssc +0 -0
  168. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_image-rendering.scssc +0 -0
  169. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_inline-block.scssc +0 -0
  170. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_keyframes.scssc +0 -0
  171. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_linear-gradient.scssc +0 -0
  172. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_perspective.scssc +0 -0
  173. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_placeholder.scssc +0 -0
  174. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_radial-gradient.scssc +0 -0
  175. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_transform.scssc +0 -0
  176. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_transition.scssc +0 -0
  177. data/spec/dummy/tmp/cache/assets/development/sass/5e68b12f5742e819b59fae21d1dedfbc3da30721/_user-select.scssc +0 -0
  178. data/spec/dummy/tmp/cache/assets/development/sass/7c52080b507114ff73ac654c0177e1dca603143b/body.scssc +0 -0
  179. data/spec/dummy/tmp/cache/assets/development/sass/7c52080b507114ff73ac654c0177e1dca603143b/forms.scssc +0 -0
  180. data/spec/dummy/tmp/cache/assets/development/sass/7c52080b507114ff73ac654c0177e1dca603143b/headings.scssc +0 -0
  181. data/spec/dummy/tmp/cache/assets/development/sass/7c52080b507114ff73ac654c0177e1dca603143b/lists.scssc +0 -0
  182. data/spec/dummy/tmp/cache/assets/development/sass/86088d5ecf0a5701fd22ac3b30255eb2bb94f550/_bourbon-deprecated-upcoming.scssc +0 -0
  183. data/spec/dummy/tmp/cache/assets/development/sass/9de1036a47599e1de75fdb2094e4960ffb18ffcf/_grid.scssc +0 -0
  184. data/spec/dummy/tmp/cache/assets/development/sass/9de1036a47599e1de75fdb2094e4960ffb18ffcf/_visual-grid.scssc +0 -0
  185. data/spec/dummy/tmp/cache/assets/development/sass/9e0f22094073a2727149869ee451bf5155b6b1de/_bourbon.scssc +0 -0
  186. data/spec/dummy/tmp/cache/assets/development/sass/9e0f22094073a2727149869ee451bf5155b6b1de/_neat.scssc +0 -0
  187. data/spec/dummy/tmp/cache/assets/development/sass/9e0f22094073a2727149869ee451bf5155b6b1de/font-awesome.scssc +0 -0
  188. data/spec/dummy/tmp/cache/assets/development/sass/ab9fa2e8e2c4d0592ca80a0885630a538ee36082/_neat-helpers.scssc +0 -0
  189. data/spec/dummy/tmp/cache/assets/development/sass/ccd8e9094d6c3af8a9493bb7fee8eae1bf9b4c52/_new-breakpoint.scssc +0 -0
  190. data/spec/dummy/tmp/cache/assets/development/sass/ccd8e9094d6c3af8a9493bb7fee8eae1bf9b4c52/_private.scssc +0 -0
  191. data/spec/dummy/tmp/cache/assets/development/sass/e32eee285e5a7bcd847a61263245c70a38794724/edit.scssc +0 -0
  192. data/spec/dummy/tmp/cache/assets/development/sass/e32eee285e5a7bcd847a61263245c70a38794724/index.scssc +0 -0
  193. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_button.scssc +0 -0
  194. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_clearfix.scssc +0 -0
  195. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_font-family.scssc +0 -0
  196. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_hide-text.scssc +0 -0
  197. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_html5-input-types.scssc +0 -0
  198. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_position.scssc +0 -0
  199. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_prefixer.scssc +0 -0
  200. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_retina-image.scssc +0 -0
  201. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_size.scssc +0 -0
  202. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_timing-functions.scssc +0 -0
  203. data/spec/dummy/tmp/cache/assets/development/sass/e792c58dcbc932d7b0bbb62be67c59da9796d04b/_triangle.scssc +0 -0
  204. data/spec/dummy/tmp/cache/assets/development/sass/f6aab6f5c59ff0b3c4ff7e11237d10cd45b5353c/layout.scssc +0 -0
  205. data/spec/dummy/tmp/cache/assets/development/sprockets/00b315c99e05fd17eb6ee63c05874610 +0 -0
  206. data/spec/dummy/tmp/cache/assets/development/sprockets/0427945c7b4a3a10bc1b628680c1ac11 +0 -0
  207. data/spec/dummy/tmp/cache/assets/development/sprockets/07a7381ab720b1fcdf48d09e6f4aca3f +0 -0
  208. data/spec/dummy/tmp/cache/assets/development/sprockets/0cba4b819c78286147e22cce1cff06de +0 -0
  209. data/spec/dummy/tmp/cache/assets/development/sprockets/0d045cc286244754010ae01a766487a9 +0 -0
  210. data/spec/dummy/tmp/cache/assets/development/sprockets/0f027312d7555aefd043bc94e678e35d +0 -0
  211. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  212. data/spec/dummy/tmp/cache/assets/development/sprockets/1590fdab706270c5d350582acc774711 +0 -0
  213. data/spec/dummy/tmp/cache/assets/development/sprockets/17d324480cb2a2a47bedc3ef4d022b6d +0 -0
  214. data/spec/dummy/tmp/cache/assets/development/sprockets/21eee9c5050e081a5a1cf91cea7d268f +0 -0
  215. data/spec/dummy/tmp/cache/assets/development/sprockets/2510376ff2d7b20d23bc38a46fcfa055 +0 -0
  216. data/spec/dummy/tmp/cache/assets/development/sprockets/26dfb7b51a72e95c414c783f2ba69222 +0 -0
  217. data/spec/dummy/tmp/cache/assets/development/sprockets/2a12abb42fb17b6520d9d9ad589a20af +0 -0
  218. data/spec/dummy/tmp/cache/assets/development/sprockets/2a87faf509efd55dfdbd16b0fa8239b4 +0 -0
  219. data/spec/dummy/tmp/cache/assets/development/sprockets/2c9e3b499f8c7da0a3d3de2510f78846 +0 -0
  220. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  221. data/spec/dummy/tmp/cache/assets/development/sprockets/2fd51b2bfa391389108d8de69733d84b +0 -0
  222. data/spec/dummy/tmp/cache/assets/development/sprockets/3075115024bd10f7adb951b3baec184c +0 -0
  223. data/spec/dummy/tmp/cache/assets/development/sprockets/309a524a7494382fd3346a82b810c20b +0 -0
  224. data/spec/dummy/tmp/cache/assets/development/sprockets/346918a665641c5e32c0bb368f032b07 +0 -0
  225. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  226. data/spec/dummy/tmp/cache/assets/development/sprockets/359a931a346dd73a40ea88a3e145e4b3 +0 -0
  227. data/spec/dummy/tmp/cache/assets/development/sprockets/3a8c2654e77e18a35f25642e5e3bcb88 +0 -0
  228. data/spec/dummy/tmp/cache/assets/development/sprockets/3a8ecba67750b8ad7df3ba9362857756 +0 -0
  229. data/spec/dummy/tmp/cache/assets/development/sprockets/3aa302111c6bea14859db6fea34cdb94 +0 -0
  230. data/spec/dummy/tmp/cache/assets/development/sprockets/3b05198beb41d8fc2b4a207128140f89 +0 -0
  231. data/spec/dummy/tmp/cache/assets/development/sprockets/3cc020c5e2e8ab2e4acd1b5a9fdc16ab +0 -0
  232. data/spec/dummy/tmp/cache/assets/development/sprockets/3d89aed04c6cdc16f097a2aabfa2b867 +0 -0
  233. data/spec/dummy/tmp/cache/assets/development/sprockets/420c2d9425469c305387fa81d5ef1b30 +0 -0
  234. data/spec/dummy/tmp/cache/assets/development/sprockets/43272d99260411613e550de399f08be8 +0 -0
  235. data/spec/dummy/tmp/cache/assets/development/sprockets/4443d626de6926b2b0e97011a9d3283b +0 -0
  236. data/spec/dummy/tmp/cache/assets/development/sprockets/44ee5490907c6fdf6530eeea203a3908 +0 -0
  237. data/spec/dummy/tmp/cache/assets/development/sprockets/4c016d0efbbfe9fa01bc4d8d800f8548 +0 -0
  238. data/spec/dummy/tmp/cache/assets/development/sprockets/4f41b46926dc79b6d378c60e5e12b1ee +0 -0
  239. data/spec/dummy/tmp/cache/assets/development/sprockets/4ffbbdb75e91e3ef76f0356bd8c9fdb9 +0 -0
  240. data/spec/dummy/tmp/cache/assets/development/sprockets/530a0c5b0d469facb66e00ca952d9069 +0 -0
  241. data/spec/dummy/tmp/cache/assets/development/sprockets/562b764135bc28106a524123de319fac +0 -0
  242. data/spec/dummy/tmp/cache/assets/development/sprockets/59cc9befd7bad256dc0139dc7c32cf34 +0 -0
  243. data/spec/dummy/tmp/cache/assets/development/sprockets/5d455edb538f158d67b710d4c8fb9674 +0 -0
  244. data/spec/dummy/tmp/cache/assets/development/sprockets/5ea0f006a9c4f5744aa307242e43d11a +0 -0
  245. data/spec/dummy/tmp/cache/assets/development/sprockets/5f1b58c3d1b05b422b95fad6ff1236ad +0 -0
  246. data/spec/dummy/tmp/cache/assets/development/sprockets/5f9c0944ded3ac10412c77764c4f83a2 +0 -0
  247. data/spec/dummy/tmp/cache/assets/development/sprockets/613e23bb1e9f2c8dbd8166803b85c57c +0 -0
  248. data/spec/dummy/tmp/cache/assets/development/sprockets/61ac9eefcbf748e59c79b6e84835babd +0 -0
  249. data/spec/dummy/tmp/cache/assets/development/sprockets/64b57c4794688cd1dd9723c89f564ad7 +0 -0
  250. data/spec/dummy/tmp/cache/assets/development/sprockets/65e56fb427fa0e3e148515a9ea998426 +0 -0
  251. data/spec/dummy/tmp/cache/assets/development/sprockets/7344269d882a3e910b3806b007dd9d71 +0 -0
  252. data/spec/dummy/tmp/cache/assets/development/sprockets/74104d7c75a8966708478065693bcca8 +0 -0
  253. data/spec/dummy/tmp/cache/assets/development/sprockets/7415c9f0125deaebddd1c12b2c26367d +0 -0
  254. data/spec/dummy/tmp/cache/assets/development/sprockets/7703867f0dd6cf86b9eb01bce45d1f02 +0 -0
  255. data/spec/dummy/tmp/cache/assets/development/sprockets/7871e5235770cb3607023e3646149255 +0 -0
  256. data/spec/dummy/tmp/cache/assets/development/sprockets/7ce4b6005f5a1535c297ebe897723551 +0 -0
  257. data/spec/dummy/tmp/cache/assets/development/sprockets/8035b3603b1f603513ce0491ef5ee98c +0 -0
  258. data/spec/dummy/tmp/cache/assets/development/sprockets/87b0d0df42a2bb5d08a5417fd0274a6e +0 -0
  259. data/spec/dummy/tmp/cache/assets/development/sprockets/88b8972e085bc284af152cf7b158334c +0 -0
  260. data/spec/dummy/tmp/cache/assets/development/sprockets/8b94d81de8f6f238037cab9a4a1a0c30 +0 -0
  261. data/spec/dummy/tmp/cache/assets/development/sprockets/8bd0f5b2d316327657d6709cf130a550 +0 -0
  262. data/spec/dummy/tmp/cache/assets/development/sprockets/8efc9dce2839c7874c8c1bb8a662acc9 +0 -0
  263. data/spec/dummy/tmp/cache/assets/development/sprockets/8f4e3d9674b96cae9b98843cd6ff18c8 +0 -0
  264. data/spec/dummy/tmp/cache/assets/development/sprockets/92a576a2bd81929a26b143cc02e430aa +0 -0
  265. data/spec/dummy/tmp/cache/assets/development/sprockets/9e58e917e624e0cd3b2154f01fd24962 +0 -0
  266. data/spec/dummy/tmp/cache/assets/development/sprockets/a0c1f9e3d33f8de75d0a594321456c9b +0 -0
  267. data/spec/dummy/tmp/cache/assets/development/sprockets/a147199745f7229dc608d3cefce5df45 +0 -0
  268. data/spec/dummy/tmp/cache/assets/development/sprockets/a72bca95d5c7b54e61fa4e0ebc869d4e +0 -0
  269. data/spec/dummy/tmp/cache/assets/development/sprockets/abe150382a2bf6466264fe8866f34157 +0 -0
  270. data/spec/dummy/tmp/cache/assets/development/sprockets/afa453539adb4bc1f7d844dcb361460d +0 -0
  271. data/spec/dummy/tmp/cache/assets/development/sprockets/b0352a0c3bd6f28326a7fc34fa51fa16 +0 -0
  272. data/spec/dummy/tmp/cache/assets/development/sprockets/b0f77fd26cd7fd672f25ec90ed445fe9 +0 -0
  273. data/spec/dummy/tmp/cache/assets/development/sprockets/b0f88bcdb6579681288ffc314d36281b +0 -0
  274. data/spec/dummy/tmp/cache/assets/development/sprockets/b304f5f5248fd1b0910adaeaf4430da9 +0 -0
  275. data/spec/dummy/tmp/cache/assets/development/sprockets/b5dd7a2c9cdd592440c578b49edff2cb +0 -0
  276. data/spec/dummy/tmp/cache/assets/development/sprockets/b7f85043b18466180fb325cbc7e709c8 +0 -0
  277. data/spec/dummy/tmp/cache/assets/development/sprockets/b8096cbfaf0aa44715d5411926461117 +0 -0
  278. data/spec/dummy/tmp/cache/assets/development/sprockets/b95fb213c4dd9e7f1fdfe6120e88e2e8 +0 -0
  279. data/spec/dummy/tmp/cache/assets/development/sprockets/be95835376c06f09fdd2a3afc3dd195e +0 -0
  280. data/spec/dummy/tmp/cache/assets/development/sprockets/bfacd7859276780db88488d7d7e41b59 +0 -0
  281. data/spec/dummy/tmp/cache/assets/development/sprockets/c954e3a10a9a27d22bbde51534852ce1 +0 -0
  282. data/spec/dummy/tmp/cache/assets/development/sprockets/cee17b1df9168d8c9075ec7c74d54cb5 +0 -0
  283. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  284. data/spec/dummy/tmp/cache/assets/development/sprockets/d101f82ff4e2f7db4eb46cc760aa1d3f +0 -0
  285. data/spec/dummy/tmp/cache/assets/development/sprockets/d1689f5fa7ff2ae20077f9de7fd130e1 +0 -0
  286. data/spec/dummy/tmp/cache/assets/development/sprockets/d31431b0b9739b7fa0843ccfd02d002b +0 -0
  287. data/spec/dummy/tmp/cache/assets/development/sprockets/d410c298186b4110d38ff3d89b29c925 +0 -0
  288. data/spec/dummy/tmp/cache/assets/development/sprockets/d4b45f77d1eed50fcf90f8c5511b99b6 +0 -0
  289. data/spec/dummy/tmp/cache/assets/development/sprockets/d62a46b4d21da7c9091dcbd8fa01da34 +0 -0
  290. data/spec/dummy/tmp/cache/assets/development/sprockets/d6477bff4412a5abb06c8acf405c8a87 +0 -0
  291. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  292. data/spec/dummy/tmp/cache/assets/development/sprockets/d985df74e53b12bfa3af9ea8608eacb2 +0 -0
  293. data/spec/dummy/tmp/cache/assets/development/sprockets/d9db27d114516b1b698ad3520e97d1f9 +0 -0
  294. data/spec/dummy/tmp/cache/assets/development/sprockets/da4c7a7a685a765695e1d781590e6a5a +0 -0
  295. data/spec/dummy/tmp/cache/assets/development/sprockets/dbe056c885afef869a46852b1faa9e60 +0 -0
  296. data/spec/dummy/tmp/cache/assets/development/sprockets/df0a14f77c1e0b39c4284d6d6fce9c97 +0 -0
  297. data/spec/dummy/tmp/cache/assets/development/sprockets/e01e232c8b2f8d1711bcd44d6e017dab +0 -0
  298. data/spec/dummy/tmp/cache/assets/development/sprockets/e333f0976af05d7bc7eca78d1383c2af +0 -0
  299. data/spec/dummy/tmp/cache/assets/development/sprockets/e95f94b756f854b191f179bd558ce3c6 +0 -0
  300. data/spec/dummy/tmp/cache/assets/development/sprockets/eb20aca7df145f553b39afab67d5c0a0 +0 -0
  301. data/spec/dummy/tmp/cache/assets/development/sprockets/edaff551a27cde6faf69cc45ba5de859 +0 -0
  302. data/spec/dummy/tmp/cache/assets/development/sprockets/ee44b9ce0a9a1e5e56418ab84da62277 +0 -0
  303. data/spec/dummy/tmp/cache/assets/development/sprockets/f345273bfd8088c36038c49a5fae3218 +0 -0
  304. data/spec/dummy/tmp/cache/assets/development/sprockets/f3a1691881f9395089d43324197ff863 +0 -0
  305. data/spec/dummy/tmp/cache/assets/development/sprockets/f4e80d0621ebd9be1b2b595ce543037f +0 -0
  306. data/spec/dummy/tmp/cache/assets/development/sprockets/f521da421cda5fe4162aeec62e594eca +0 -0
  307. data/spec/dummy/tmp/cache/assets/development/sprockets/f6fcfc1f4419ff69a85c86234ba475cf +0 -0
  308. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  309. data/spec/dummy/tmp/cache/assets/development/sprockets/f8c2ccce91ab7c89ad8922be93c6f363 +0 -0
  310. data/spec/dummy/tmp/cache/assets/development/sprockets/fa0df232aba62e841f6077c735cec1aa +0 -0
  311. data/spec/dummy/tmp/cache/assets/development/sprockets/fb892eb8050ec923cc8084138b1e6e28 +0 -0
  312. data/spec/factories/content_block_factory.rb +0 -13
  313. data/spec/models/blocky/content_block_spec.rb +0 -37
  314. data/spec/spec_helper.rb +0 -34
  315. data/vendor/assets/fonts/blocky/FontAwesome.otf +0 -0
  316. data/vendor/assets/fonts/blocky/fontawesome-webfont.eot +0 -0
  317. data/vendor/assets/fonts/blocky/fontawesome-webfont.svg +0 -414
  318. data/vendor/assets/fonts/blocky/fontawesome-webfont.ttf +0 -0
  319. data/vendor/assets/fonts/blocky/fontawesome-webfont.woff +0 -0
  320. data/vendor/assets/javascripts/blocky/bootstrap.js +0 -1951
  321. data/vendor/assets/javascripts/blocky/codemirror/closebrackets.js +0 -84
  322. data/vendor/assets/javascripts/blocky/codemirror/codemirror.js +0 -4442
  323. data/vendor/assets/javascripts/blocky/codemirror/formatting.js +0 -1
  324. data/vendor/assets/javascripts/blocky/codemirror/xml.js +0 -1
  325. data/vendor/assets/javascripts/blocky/jquery.js +0 -10338
  326. data/vendor/assets/javascripts/blocky/jquery_ujs.js +0 -398
  327. data/vendor/assets/javascripts/blocky/summernote.js +0 -3922
  328. data/vendor/assets/stylesheets/blocky/_bourbon.scss +0 -59
  329. data/vendor/assets/stylesheets/blocky/_neat.scss +0 -21
  330. data/vendor/assets/stylesheets/blocky/bootstrap.css +0 -5785
  331. data/vendor/assets/stylesheets/blocky/bootstrap.css.map +0 -1
  332. data/vendor/assets/stylesheets/blocky/bourbon/_bourbon-deprecated-upcoming.scss +0 -13
  333. data/vendor/assets/stylesheets/blocky/bourbon/addons/_button.scss +0 -273
  334. data/vendor/assets/stylesheets/blocky/bourbon/addons/_clearfix.scss +0 -29
  335. data/vendor/assets/stylesheets/blocky/bourbon/addons/_font-family.scss +0 -5
  336. data/vendor/assets/stylesheets/blocky/bourbon/addons/_hide-text.scss +0 -5
  337. data/vendor/assets/stylesheets/blocky/bourbon/addons/_html5-input-types.scss +0 -56
  338. data/vendor/assets/stylesheets/blocky/bourbon/addons/_position.scss +0 -42
  339. data/vendor/assets/stylesheets/blocky/bourbon/addons/_prefixer.scss +0 -49
  340. data/vendor/assets/stylesheets/blocky/bourbon/addons/_retina-image.scss +0 -32
  341. data/vendor/assets/stylesheets/blocky/bourbon/addons/_size.scss +0 -44
  342. data/vendor/assets/stylesheets/blocky/bourbon/addons/_timing-functions.scss +0 -32
  343. data/vendor/assets/stylesheets/blocky/bourbon/addons/_triangle.scss +0 -45
  344. data/vendor/assets/stylesheets/blocky/bourbon/css3/_animation.scss +0 -52
  345. data/vendor/assets/stylesheets/blocky/bourbon/css3/_appearance.scss +0 -3
  346. data/vendor/assets/stylesheets/blocky/bourbon/css3/_backface-visibility.scss +0 -6
  347. data/vendor/assets/stylesheets/blocky/bourbon/css3/_background-image.scss +0 -48
  348. data/vendor/assets/stylesheets/blocky/bourbon/css3/_background.scss +0 -103
  349. data/vendor/assets/stylesheets/blocky/bourbon/css3/_border-image.scss +0 -55
  350. data/vendor/assets/stylesheets/blocky/bourbon/css3/_border-radius.scss +0 -22
  351. data/vendor/assets/stylesheets/blocky/bourbon/css3/_box-sizing.scss +0 -4
  352. data/vendor/assets/stylesheets/blocky/bourbon/css3/_columns.scss +0 -47
  353. data/vendor/assets/stylesheets/blocky/bourbon/css3/_flex-box.scss +0 -52
  354. data/vendor/assets/stylesheets/blocky/bourbon/css3/_font-face.scss +0 -23
  355. data/vendor/assets/stylesheets/blocky/bourbon/css3/_hidpi-media-query.scss +0 -10
  356. data/vendor/assets/stylesheets/blocky/bourbon/css3/_image-rendering.scss +0 -13
  357. data/vendor/assets/stylesheets/blocky/bourbon/css3/_inline-block.scss +0 -8
  358. data/vendor/assets/stylesheets/blocky/bourbon/css3/_keyframes.scss +0 -43
  359. data/vendor/assets/stylesheets/blocky/bourbon/css3/_linear-gradient.scss +0 -41
  360. data/vendor/assets/stylesheets/blocky/bourbon/css3/_perspective.scss +0 -8
  361. data/vendor/assets/stylesheets/blocky/bourbon/css3/_placeholder.scss +0 -29
  362. data/vendor/assets/stylesheets/blocky/bourbon/css3/_radial-gradient.scss +0 -44
  363. data/vendor/assets/stylesheets/blocky/bourbon/css3/_transform.scss +0 -15
  364. data/vendor/assets/stylesheets/blocky/bourbon/css3/_transition.scss +0 -34
  365. data/vendor/assets/stylesheets/blocky/bourbon/css3/_user-select.scss +0 -3
  366. data/vendor/assets/stylesheets/blocky/bourbon/functions/_compact.scss +0 -11
  367. data/vendor/assets/stylesheets/blocky/bourbon/functions/_flex-grid.scss +0 -39
  368. data/vendor/assets/stylesheets/blocky/bourbon/functions/_grid-width.scss +0 -13
  369. data/vendor/assets/stylesheets/blocky/bourbon/functions/_linear-gradient.scss +0 -13
  370. data/vendor/assets/stylesheets/blocky/bourbon/functions/_modular-scale.scss +0 -40
  371. data/vendor/assets/stylesheets/blocky/bourbon/functions/_px-to-em.scss +0 -8
  372. data/vendor/assets/stylesheets/blocky/bourbon/functions/_radial-gradient.scss +0 -23
  373. data/vendor/assets/stylesheets/blocky/bourbon/functions/_tint-shade.scss +0 -9
  374. data/vendor/assets/stylesheets/blocky/bourbon/functions/_transition-property-name.scss +0 -22
  375. data/vendor/assets/stylesheets/blocky/bourbon/helpers/_deprecated-webkit-gradient.scss +0 -39
  376. data/vendor/assets/stylesheets/blocky/bourbon/helpers/_gradient-positions-parser.scss +0 -13
  377. data/vendor/assets/stylesheets/blocky/bourbon/helpers/_linear-positions-parser.scss +0 -61
  378. data/vendor/assets/stylesheets/blocky/bourbon/helpers/_radial-arg-parser.scss +0 -69
  379. data/vendor/assets/stylesheets/blocky/bourbon/helpers/_radial-positions-parser.scss +0 -18
  380. data/vendor/assets/stylesheets/blocky/bourbon/helpers/_render-gradients.scss +0 -26
  381. data/vendor/assets/stylesheets/blocky/bourbon/helpers/_shape-size-stripper.scss +0 -10
  382. data/vendor/assets/stylesheets/blocky/codemirror/codemirror.css +0 -1
  383. data/vendor/assets/stylesheets/blocky/codemirror/monokai.css +0 -1
  384. data/vendor/assets/stylesheets/blocky/font-awesome.scss +0 -17
  385. data/vendor/assets/stylesheets/blocky/font-awesome/_bordered-pulled.scss +0 -16
  386. data/vendor/assets/stylesheets/blocky/font-awesome/_core.scss +0 -12
  387. data/vendor/assets/stylesheets/blocky/font-awesome/_fixed-width.scss +0 -6
  388. data/vendor/assets/stylesheets/blocky/font-awesome/_icons.scss +0 -412
  389. data/vendor/assets/stylesheets/blocky/font-awesome/_larger.scss +0 -13
  390. data/vendor/assets/stylesheets/blocky/font-awesome/_list.scss +0 -19
  391. data/vendor/assets/stylesheets/blocky/font-awesome/_mixins.scss +0 -20
  392. data/vendor/assets/stylesheets/blocky/font-awesome/_path.scss +0 -13
  393. data/vendor/assets/stylesheets/blocky/font-awesome/_rotated-flipped.scss +0 -9
  394. data/vendor/assets/stylesheets/blocky/font-awesome/_spinning.scss +0 -30
  395. data/vendor/assets/stylesheets/blocky/font-awesome/_stacked.scss +0 -20
  396. data/vendor/assets/stylesheets/blocky/font-awesome/_variables.scss +0 -381
  397. data/vendor/assets/stylesheets/blocky/neat/_neat-helpers.scss +0 -7
  398. data/vendor/assets/stylesheets/blocky/neat/functions/_new-breakpoint.scss +0 -16
  399. data/vendor/assets/stylesheets/blocky/neat/functions/_private.scss +0 -125
  400. data/vendor/assets/stylesheets/blocky/neat/grid/_fill-parent.scss +0 -7
  401. data/vendor/assets/stylesheets/blocky/neat/grid/_grid.scss +0 -5
  402. data/vendor/assets/stylesheets/blocky/neat/grid/_media.scss +0 -51
  403. data/vendor/assets/stylesheets/blocky/neat/grid/_omega.scss +0 -79
  404. data/vendor/assets/stylesheets/blocky/neat/grid/_outer-container.scss +0 -8
  405. data/vendor/assets/stylesheets/blocky/neat/grid/_pad.scss +0 -8
  406. data/vendor/assets/stylesheets/blocky/neat/grid/_private.scss +0 -50
  407. data/vendor/assets/stylesheets/blocky/neat/grid/_reset.scss +0 -12
  408. data/vendor/assets/stylesheets/blocky/neat/grid/_row.scss +0 -17
  409. data/vendor/assets/stylesheets/blocky/neat/grid/_shift.scss +0 -16
  410. data/vendor/assets/stylesheets/blocky/neat/grid/_span-columns.scss +0 -45
  411. data/vendor/assets/stylesheets/blocky/neat/grid/_to-deprecate.scss +0 -57
  412. data/vendor/assets/stylesheets/blocky/neat/grid/_visual-grid.scss +0 -41
  413. data/vendor/assets/stylesheets/blocky/neat/settings/_grid.scss +0 -7
  414. data/vendor/assets/stylesheets/blocky/neat/settings/_visual-grid.scss +0 -5
  415. data/vendor/assets/stylesheets/blocky/normalize.css +0 -423
  416. data/vendor/assets/stylesheets/blocky/summernote.css +0 -1
@@ -1,84 +0,0 @@
1
- (function() {
2
- var DEFAULT_BRACKETS = "()[]{}''\"\"";
3
- var DEFAULT_EXPLODE_ON_ENTER = "[]{}";
4
- var SPACE_CHAR_REGEX = /\s/;
5
-
6
- CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
7
- if (old != CodeMirror.Init && old)
8
- cm.removeKeyMap("autoCloseBrackets");
9
- if (!val) return;
10
- var pairs = DEFAULT_BRACKETS, explode = DEFAULT_EXPLODE_ON_ENTER;
11
- if (typeof val == "string") pairs = val;
12
- else if (typeof val == "object") {
13
- if (val.pairs != null) pairs = val.pairs;
14
- if (val.explode != null) explode = val.explode;
15
- }
16
- var map = buildKeymap(pairs);
17
- if (explode) map.Enter = buildExplodeHandler(explode);
18
- cm.addKeyMap(map);
19
- });
20
-
21
- function charsAround(cm, pos) {
22
- var str = cm.getRange(CodeMirror.Pos(pos.line, pos.ch - 1),
23
- CodeMirror.Pos(pos.line, pos.ch + 1));
24
- return str.length == 2 ? str : null;
25
- }
26
-
27
- function buildKeymap(pairs) {
28
- var map = {
29
- name : "autoCloseBrackets",
30
- Backspace: function(cm) {
31
- if (cm.somethingSelected() || cm.getOption("disableInput")) return CodeMirror.Pass;
32
- var cur = cm.getCursor(), around = charsAround(cm, cur);
33
- if (around && pairs.indexOf(around) % 2 == 0)
34
- cm.replaceRange("", CodeMirror.Pos(cur.line, cur.ch - 1), CodeMirror.Pos(cur.line, cur.ch + 1));
35
- else
36
- return CodeMirror.Pass;
37
- }
38
- };
39
- var closingBrackets = "";
40
- for (var i = 0; i < pairs.length; i += 2) (function(left, right) {
41
- if (left != right) closingBrackets += right;
42
- function surround(cm) {
43
- var selection = cm.getSelection();
44
- cm.replaceSelection(left + selection + right);
45
- }
46
- function maybeOverwrite(cm) {
47
- var cur = cm.getCursor(), ahead = cm.getRange(cur, CodeMirror.Pos(cur.line, cur.ch + 1));
48
- if (ahead != right || cm.somethingSelected()) return CodeMirror.Pass;
49
- else cm.execCommand("goCharRight");
50
- }
51
- map["'" + left + "'"] = function(cm) {
52
- if (left == "'" && cm.getTokenAt(cm.getCursor()).type == "comment" ||
53
- cm.getOption("disableInput"))
54
- return CodeMirror.Pass;
55
- if (cm.somethingSelected()) return surround(cm);
56
- if (left == right && maybeOverwrite(cm) != CodeMirror.Pass) return;
57
- var cur = cm.getCursor(), ahead = CodeMirror.Pos(cur.line, cur.ch + 1);
58
- var line = cm.getLine(cur.line), nextChar = line.charAt(cur.ch), curChar = cur.ch > 0 ? line.charAt(cur.ch - 1) : "";
59
- if (left == right && CodeMirror.isWordChar(curChar))
60
- return CodeMirror.Pass;
61
- if (line.length == cur.ch || closingBrackets.indexOf(nextChar) >= 0 || SPACE_CHAR_REGEX.test(nextChar))
62
- cm.replaceSelection(left + right, {head: ahead, anchor: ahead});
63
- else
64
- return CodeMirror.Pass;
65
- };
66
- if (left != right) map["'" + right + "'"] = maybeOverwrite;
67
- })(pairs.charAt(i), pairs.charAt(i + 1));
68
- return map;
69
- }
70
-
71
- function buildExplodeHandler(pairs) {
72
- return function(cm) {
73
- var cur = cm.getCursor(), around = charsAround(cm, cur);
74
- if (!around || pairs.indexOf(around) % 2 != 0 || cm.getOption("disableInput"))
75
- return CodeMirror.Pass;
76
- cm.operation(function() {
77
- var newPos = CodeMirror.Pos(cur.line + 1, 0);
78
- cm.replaceSelection("\n\n", {anchor: newPos, head: newPos}, "+input");
79
- cm.indentLine(cur.line + 1, null, true);
80
- cm.indentLine(cur.line + 2, null, true);
81
- });
82
- };
83
- }
84
- })();
@@ -1,4442 +0,0 @@
1
- // CodeMirror version 3.20
2
- //
3
- // CodeMirror is the only global var we claim
4
- window.CodeMirror = function() {
5
- "use strict";
6
- function x(e, n) {
7
- if (!(this instanceof x))
8
- return new x(e, n);
9
- this.options = n = n || {};
10
- for (var r in er)
11
- !n.hasOwnProperty(r) && er.hasOwnProperty(r) && (n[r] = er[r]);
12
- H(n);
13
- var i = typeof n.value == "string" ? 0: n.value.first, s = this.display = T(e, i);
14
- s.wrapper.CodeMirror = this, _(this), n.autofocus&&!v && It(this), this.state = {
15
- keyMaps: [],
16
- overlays: [],
17
- modeGen: 0,
18
- overwrite: !1,
19
- focused: !1,
20
- suppressEdits: !1,
21
- pasteIncoming: !1,
22
- draggingText: !1,
23
- highlight: new Qi
24
- }, O(this), n.lineWrapping && (this.display.wrapper.className += " CodeMirror-wrap");
25
- var o = n.value;
26
- typeof o == "string" && (o = new ui(n.value, n.mode)), Mt(this, ci)(this, o), t && setTimeout(os(Ft, this, !0), 20), Rt(this);
27
- var u;
28
- try {
29
- u = document.activeElement == s.input
30
- } catch (a) {}
31
- u || n.autofocus&&!v ? setTimeout(os(pn, this), 20) : dn(this), Mt(this, function() {
32
- for (var e in Zn)
33
- Zn.propertyIsEnumerable(e) && Zn[e](this, n[e], nr);
34
- for (var t = 0; t < or.length; ++t)
35
- or[t](this)
36
- })()
37
- }
38
- function T(e, t) {
39
- var r = {}, i = r.input = cs("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");
40
- return s ? i.style.width = "1000px" : i.setAttribute("wrap", "off"), d && (i.style.border = "1px solid black"), i.setAttribute("autocorrect", "off"), i.setAttribute("autocapitalize", "off"), i.setAttribute("spellcheck", "false"), r.inputDiv = cs("div", [i], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"), r.scrollbarH = cs("div", [cs("div", null, null, "height: 1px")], "CodeMirror-hscrollbar"), r.scrollbarV = cs("div", [cs("div", null, null, "width: 1px")], "CodeMirror-vscrollbar"), r.scrollbarFiller = cs("div", null, "CodeMirror-scrollbar-filler"), r.gutterFiller = cs("div", null, "CodeMirror-gutter-filler"), r.lineDiv = cs("div", null, "CodeMirror-code"), r.selectionDiv = cs("div", null, null, "position: relative; z-index: 1"), r.cursor = cs("div", " ", "CodeMirror-cursor"), r.otherCursor = cs("div", " ", "CodeMirror-cursor CodeMirror-secondarycursor"), r.measure = cs("div", null, "CodeMirror-measure"), r.lineSpace = cs("div", [r.measure, r.selectionDiv, r.lineDiv, r.cursor, r.otherCursor], null, "position: relative; outline: none"), r.mover = cs("div", [cs("div", [r.lineSpace], "CodeMirror-lines")], null, "position: relative"), r.sizer = cs("div", [r.mover], "CodeMirror-sizer"), r.heightForcer = cs("div", null, null, "position: absolute; height: " + Ji + "px; width: 1px;"), r.gutters = cs("div", null, "CodeMirror-gutters"), r.lineGutter = null, r.scroller = cs("div", [r.sizer, r.heightForcer, r.gutters], "CodeMirror-scroll"), r.scroller.setAttribute("tabIndex", "-1"), r.wrapper = cs("div", [r.inputDiv, r.scrollbarH, r.scrollbarV, r.scrollbarFiller, r.gutterFiller, r.scroller], "CodeMirror"), n && (r.gutters.style.zIndex =- 1, r.scroller.style.paddingRight = 0), e.appendChild ? e.appendChild(r.wrapper) : e(r.wrapper), d && (i.style.width = "0px"), s || (r.scroller.draggable=!0), l ? (r.inputDiv.style.height = "1px", r.inputDiv.style.position = "absolute") : n && (r.scrollbarH.style.minWidth = r.scrollbarV.style.minWidth = "18px"), r.viewOffset = r.lastSizeC = 0, r.showingFrom = r.showingTo = t, r.lineNumWidth = r.lineNumInnerWidth = r.lineNumChars = null, r.prevInput = "", r.alignWidgets=!1, r.pollingFast=!1, r.poll = new Qi, r.cachedCharWidth = r.cachedTextHeight = null, r.measureLineCache = [], r.measureLineCachePos = 0, r.inaccurateSelection=!1, r.maxLine = null, r.maxLineLength = 0, r.maxLineChanged=!1, r.wheelDX = r.wheelDY = r.wheelStartX = r.wheelStartY = null, r
41
- }
42
- function N(e) {
43
- e.doc.mode = x.getMode(e.options, e.doc.modeOption), e.doc.iter(function(e) {
44
- e.stateAfter && (e.stateAfter = null), e.styles && (e.styles = null)
45
- }), e.doc.frontier = e.doc.first, tt(e, 100), e.state.modeGen++, e.curOp && Pt(e)
46
- }
47
- function C(e) {
48
- e.options.lineWrapping ? (e.display.wrapper.className += " CodeMirror-wrap", e.display.sizer.style.minWidth = "") : (e.display.wrapper.className = e.display.wrapper.className.replace(" CodeMirror-wrap", ""), P(e)), L(e), Pt(e), vt(e), setTimeout(function() {
49
- B(e)
50
- }, 100)
51
- }
52
- function k(e) {
53
- var t = Ct(e.display), n = e.options.lineWrapping, r = n && Math.max(5, e.display.scroller.clientWidth / kt(e.display)-3);
54
- return function(i) {
55
- return Dr(e.doc, i) ? 0 : n ? (Math.ceil(i.text.length / r) || 1) * t : t
56
- }
57
- }
58
- function L(e) {
59
- var t = e.doc, n = k(e);
60
- t.iter(function(e) {
61
- var t = n(e);
62
- t != e.height && vi(e, t)
63
- })
64
- }
65
- function A(e) {
66
- var t = cr[e.options.keyMap], n = t.style;
67
- e.display.wrapper.className = e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g, "") + (n ? " cm-keymap-" + n : ""), e.state.disableInput = t.disableInput
68
- }
69
- function O(e) {
70
- e.display.wrapper.className = e.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + e.options.theme.replace(/(^|\s)\s*/g, " cm-s-"), vt(e)
71
- }
72
- function M(e) {
73
- _(e), Pt(e), setTimeout(function() {
74
- F(e)
75
- }, 20)
76
- }
77
- function _(e) {
78
- var t = e.display.gutters, n = e.options.gutters;
79
- hs(t);
80
- for (var r = 0; r < n.length; ++r) {
81
- var i = n[r], s = t.appendChild(cs("div", null, "CodeMirror-gutter " + i));
82
- i == "CodeMirror-linenumbers" && (e.display.lineGutter = s, s.style.width = (e.display.lineNumWidth || 1) + "px")
83
- }
84
- t.style.display = r ? "" : "none"
85
- }
86
- function D(e, t) {
87
- if (t.height == 0)
88
- return 0;
89
- var n = t.text.length, r, i = t;
90
- while (r = Or(i)) {
91
- var s = r.find();
92
- i = hi(e, s.from.line), n += s.from.ch - s.to.ch
93
- }
94
- i = t;
95
- while (r = Mr(i)) {
96
- var s = r.find();
97
- n -= i.text.length - s.from.ch, i = hi(e, s.to.line), n += i.text.length - s.to.ch
98
- }
99
- return n
100
- }
101
- function P(e) {
102
- var t = e.display, n = e.doc;
103
- t.maxLine = hi(n, n.first), t.maxLineLength = D(n, t.maxLine), t.maxLineChanged=!0, n.iter(function(e) {
104
- var r = D(n, e);
105
- r > t.maxLineLength && (t.maxLineLength = r, t.maxLine = e)
106
- })
107
- }
108
- function H(e) {
109
- var t = ns(e.gutters, "CodeMirror-linenumbers");
110
- t==-1 && e.lineNumbers ? e.gutters = e.gutters.concat(["CodeMirror-linenumbers"]) : t>-1&&!e.lineNumbers && (e.gutters = e.gutters.slice(0), e.gutters.splice(t, 1))
111
- }
112
- function B(e) {
113
- var t = e.display, n = e.doc.height, r = n + ot(t);
114
- t.sizer.style.minHeight = t.heightForcer.style.top = r + "px", t.gutters.style.height = Math.max(r, t.scroller.clientHeight - Ji) + "px";
115
- var i = Math.max(r, t.scroller.scrollHeight), s = t.scroller.scrollWidth > t.scroller.clientWidth + 1, o = i > t.scroller.clientHeight + 1;
116
- o ? (t.scrollbarV.style.display = "block", t.scrollbarV.style.bottom = s ? bs(t.measure) + "px" : "0", t.scrollbarV.firstChild.style.height = i - t.scroller.clientHeight + t.scrollbarV.clientHeight + "px") : (t.scrollbarV.style.display = "", t.scrollbarV.firstChild.style.height = "0"), s ? (t.scrollbarH.style.display = "block", t.scrollbarH.style.right = o ? bs(t.measure) + "px" : "0", t.scrollbarH.firstChild.style.width = t.scroller.scrollWidth - t.scroller.clientWidth + t.scrollbarH.clientWidth + "px") : (t.scrollbarH.style.display = "", t.scrollbarH.firstChild.style.width = "0"), s && o ? (t.scrollbarFiller.style.display = "block", t.scrollbarFiller.style.height = t.scrollbarFiller.style.width = bs(t.measure) + "px") : t.scrollbarFiller.style.display = "", s && e.options.coverGutterNextToScrollbar && e.options.fixedGutter ? (t.gutterFiller.style.display = "block", t.gutterFiller.style.height = bs(t.measure) + "px", t.gutterFiller.style.width = t.gutters.offsetWidth + "px") : t.gutterFiller.style.display = "", c && bs(t.measure) === 0 && (t.scrollbarV.style.minWidth = t.scrollbarH.style.minHeight = h ? "18px" : "12px", t.scrollbarV.style.pointerEvents = t.scrollbarH.style.pointerEvents = "none")
117
- }
118
- function j(e, t, n) {
119
- var r = e.scroller.scrollTop, i = e.wrapper.clientHeight;
120
- typeof n == "number" ? r = n : n && (r = n.top, i = n.bottom - n.top), r = Math.floor(r - st(e));
121
- var s = Math.ceil(r + i);
122
- return {
123
- from: gi(t, r),
124
- to: gi(t, s)
125
- }
126
- }
127
- function F(e) {
128
- var t = e.display;
129
- if (!t.alignWidgets && (!t.gutters.firstChild ||!e.options.fixedGutter))
130
- return;
131
- var n = R(t) - t.scroller.scrollLeft + e.doc.scrollLeft, r = t.gutters.offsetWidth, i = n + "px";
132
- for (var s = t.lineDiv.firstChild; s; s = s.nextSibling)
133
- if (s.alignable)
134
- for (var o = 0, u = s.alignable; o < u.length; ++o)
135
- u[o].style.left = i;
136
- e.options.fixedGutter && (t.gutters.style.left = n + r + "px")
137
- }
138
- function I(e) {
139
- if (!e.options.lineNumbers)
140
- return !1;
141
- var t = e.doc, n = q(e.options, t.first + t.size-1), r = e.display;
142
- if (n.length != r.lineNumChars) {
143
- var i = r.measure.appendChild(cs("div", [cs("div", n)], "CodeMirror-linenumber CodeMirror-gutter-elt")), s = i.firstChild.offsetWidth, o = i.offsetWidth - s;
144
- return r.lineGutter.style.width = "", r.lineNumInnerWidth = Math.max(s, r.lineGutter.offsetWidth - o), r.lineNumWidth = r.lineNumInnerWidth + o, r.lineNumChars = r.lineNumInnerWidth ? n.length : -1, r.lineGutter.style.width = r.lineNumWidth + "px", !0
145
- }
146
- return !1
147
- }
148
- function q(e, t) {
149
- return String(e.lineNumberFormatter(t + e.firstLineNumber))
150
- }
151
- function R(e) {
152
- return vs(e.scroller).left - vs(e.sizer).left
153
- }
154
- function U(e, t, n, r) {
155
- var i = e.display.showingFrom, s = e.display.showingTo, o, u = j(e.display, e.doc, n);
156
- for (var a=!0; ; a=!1) {
157
- var f = e.display.scroller.clientWidth;
158
- if (!z(e, t, u, r))
159
- break;
160
- o=!0, t = [], G(e), B(e);
161
- if (a && e.options.lineWrapping && f != e.display.scroller.clientWidth) {
162
- r=!0;
163
- continue
164
- }
165
- r=!1, n && (n = Math.min(e.display.scroller.scrollHeight - e.display.scroller.clientHeight, typeof n == "number" ? n : n.top)), u = j(e.display, e.doc, n);
166
- if (u.from >= e.display.showingFrom && u.to <= e.display.showingTo)
167
- break
168
- }
169
- return o && (zi(e, "update", e), (e.display.showingFrom != i || e.display.showingTo != s) && zi(e, "viewportChange", e, e.display.showingFrom, e.display.showingTo)), o
170
- }
171
- function z(e, t, n, r) {
172
- var i = e.display, s = e.doc;
173
- if (!i.wrapper.clientWidth) {
174
- i.showingFrom = i.showingTo = s.first, i.viewOffset = 0;
175
- return
176
- }
177
- if (!r && t.length == 0 && n.from > i.showingFrom && n.to < i.showingTo)
178
- return;
179
- I(e) && (t = [{
180
- from: s.first,
181
- to: s.first + s.size
182
- }
183
- ]);
184
- var o = i.sizer.style.marginLeft = i.gutters.offsetWidth + "px";
185
- i.scrollbarH.style.left = e.options.fixedGutter ? o : "0";
186
- var u = Infinity;
187
- if (e.options.lineNumbers)
188
- for (var a = 0; a < t.length; ++a)
189
- t[a].diff && t[a].from < u && (u = t[a].from);
190
- var f = s.first + s.size, l = Math.max(n.from - e.options.viewportMargin, s.first), c = Math.min(f, n.to + e.options.viewportMargin);
191
- i.showingFrom < l && l - i.showingFrom < 20 && (l = Math.max(s.first, i.showingFrom)), i.showingTo > c && i.showingTo - c < 20 && (c = Math.min(f, i.showingTo));
192
- if (S) {
193
- l = mi(_r(s, hi(s, l)));
194
- while (c < f && Dr(s, hi(s, c)))++c
195
- }
196
- var h = [{
197
- from: Math.max(i.showingFrom, s.first),
198
- to: Math.min(i.showingTo, f)
199
- }
200
- ];
201
- h[0].from >= h[0].to ? h = [] : h = V(h, t);
202
- if (S)
203
- for (var a = 0; a < h.length; ++a) {
204
- var p = h[a], d;
205
- while (d = Mr(hi(s, p.to-1))) {
206
- var v = d.find().from.line;
207
- if (!(v > p.from)) {
208
- h.splice(a--, 1);
209
- break
210
- }
211
- p.to = v
212
- }
213
- }
214
- var m = 0;
215
- for (var a = 0; a < h.length; ++a) {
216
- var p = h[a];
217
- p.from < l && (p.from = l), p.to > c && (p.to = c), p.from >= p.to ? h.splice(a--, 1) : m += p.to - p.from
218
- }
219
- if (!r && m == c - l && l == i.showingFrom && c == i.showingTo) {
220
- X(e);
221
- return
222
- }
223
- h.sort(function(e, t) {
224
- return e.from - t.from
225
- });
226
- try {
227
- var g = document.activeElement
228
- } catch (y) {}
229
- m < (c - l) * .7 && (i.lineDiv.style.display = "none"), J(e, l, c, h, u), i.lineDiv.style.display = "", g && document.activeElement != g && g.offsetHeight && g.focus();
230
- var b = l != i.showingFrom || c != i.showingTo || i.lastSizeC != i.wrapper.clientHeight;
231
- return b && (i.lastSizeC = i.wrapper.clientHeight, tt(e, 400)), i.showingFrom = l, i.showingTo = c, W(e), X(e), !0
232
- }
233
- function W(e) {
234
- var t = e.display, r = t.lineDiv.offsetTop;
235
- for (var i = t.lineDiv.firstChild, s; i; i = i.nextSibling)
236
- if (i.lineObj) {
237
- if (n) {
238
- var o = i.offsetTop + i.offsetHeight;
239
- s = o - r, r = o
240
- } else {
241
- var u = vs(i);
242
- s = u.bottom - u.top
243
- }
244
- var a = i.lineObj.height - s;
245
- s < 2 && (s = Ct(t));
246
- if (a > .001 || a<-0.001) {
247
- vi(i.lineObj, s);
248
- var f = i.lineObj.widgets;
249
- if (f)
250
- for (var l = 0; l < f.length; ++l)
251
- f[l].height = f[l].node.offsetHeight
252
- }
253
- }
254
- }
255
- function X(e) {
256
- var t = e.display.viewOffset = yi(e, hi(e.doc, e.display.showingFrom));
257
- e.display.mover.style.top = t + "px"
258
- }
259
- function V(e, t) {
260
- for (var n = 0, r = t.length || 0; n < r; ++n) {
261
- var i = t[n], s = [], o = i.diff || 0;
262
- for (var u = 0, a = e.length; u < a; ++u) {
263
- var f = e[u];
264
- i.to <= f.from && i.diff ? s.push({
265
- from: f.from + o,
266
- to: f.to + o
267
- }) : i.to <= f.from || i.from >= f.to ? s.push(f) : (i.from > f.from && s.push({
268
- from: f.from,
269
- to: i.from
270
- }), i.to < f.to && s.push({
271
- from : i.to + o, to : f.to + o
272
- }))
273
- }
274
- e = s
275
- }
276
- return e
277
- }
278
- function $(e) {
279
- var t = e.display, n = {}, r = {};
280
- for (var i = t.gutters.firstChild, s = 0; i; i = i.nextSibling, ++s)
281
- n[e.options.gutters[s]] = i.offsetLeft, r[e.options.gutters[s]] = i.offsetWidth;
282
- return {
283
- fixedPos: R(t),
284
- gutterTotalWidth: t.gutters.offsetWidth,
285
- gutterLeft: n,
286
- gutterWidth: r,
287
- wrapperWidth: t.wrapper.clientWidth
288
- }
289
- }
290
- function J(e, t, n, r, i) {
291
- function c(t) {
292
- var n = t.nextSibling;
293
- return s && m && e.display.currentWheelTarget == t ? (t.style.display = "none", t.lineObj = null) : t.parentNode.removeChild(t), n
294
- }
295
- var o = $(e), u = e.display, a = e.options.lineNumbers;
296
- !r.length && (!s ||!e.display.currentWheelTarget) && hs(u.lineDiv);
297
- var f = u.lineDiv, l = f.firstChild, h = r.shift(), p = t;
298
- e.doc.iter(t, n, function(t) {
299
- h && h.to == p && (h = r.shift());
300
- if (Dr(e.doc, t)) {
301
- t.height != 0 && vi(t, 0);
302
- if (t.widgets && l && l.previousSibling)
303
- for (var n = 0; n < t.widgets.length; ++n) {
304
- var s = t.widgets[n];
305
- if (s.showIfHidden) {
306
- var u = l.previousSibling;
307
- if (/pre/i.test(u.nodeName)) {
308
- var d = cs("div", null, null, "position: relative");
309
- u.parentNode.replaceChild(d, u), d.appendChild(u), u = d
310
- }
311
- var v = u.appendChild(cs("div", [s.node], "CodeMirror-linewidget"));
312
- s.handleMouseEvents || (v.ignoreEvents=!0), Q(s, v, u, o)
313
- }
314
- }
315
- } else if (h && h.from <= p && h.to > p) {
316
- while (l.lineObj != t)
317
- l = c(l);
318
- a && i <= p && l.lineNumber && ds(l.lineNumber, q(e.options, p)), l = l.nextSibling
319
- } else {
320
- if (t.widgets)
321
- for (var m = 0, g = l, y; g && m < 20; ++m, g = g.nextSibling)
322
- if (g.lineObj == t && /div/i.test(g.nodeName)) {
323
- y = g;
324
- break
325
- }
326
- var b = K(e, t, p, o, y);
327
- if (b != y)
328
- f.insertBefore(b, l);
329
- else {
330
- while (l != y)
331
- l = c(l);
332
- l = l.nextSibling
333
- }
334
- b.lineObj = t
335
- }
336
- ++p
337
- });
338
- while (l)
339
- l = c(l)
340
- }
341
- function K(e, t, r, i, s) {
342
- var o = Qr(e, t), u = o.pre, a = t.gutterMarkers, f = e.display, l, c = o.bgClass ? o.bgClass + " " + (t.bgClass || ""): t.bgClass;
343
- if (!e.options.lineNumbers&&!a&&!c&&!t.wrapClass&&!t.widgets)
344
- return u;
345
- if (s) {
346
- s.alignable = null;
347
- var h=!0, p = 0, d = null;
348
- for (var v = s.firstChild, m; v; v = m) {
349
- m = v.nextSibling;
350
- if (!/\bCodeMirror-linewidget\b/.test(v.className))
351
- s.removeChild(v);
352
- else {
353
- for (var g = 0; g < t.widgets.length; ++g) {
354
- var y = t.widgets[g];
355
- if (y.node == v.firstChild) {
356
- !y.above&&!d && (d = v), Q(y, v, s, i), ++p;
357
- break
358
- }
359
- }
360
- if (g == t.widgets.length) {
361
- h=!1;
362
- break
363
- }
364
- }
365
- }
366
- s.insertBefore(u, d), h && p == t.widgets.length && (l = s, s.className = t.wrapClass || "")
367
- }
368
- l || (l = cs("div", null, t.wrapClass, "position: relative"), l.appendChild(u)), c && l.insertBefore(cs("div", null, c + " CodeMirror-linebackground"), l.firstChild);
369
- if (e.options.lineNumbers || a) {
370
- var b = l.insertBefore(cs("div", null, null, "position: absolute; left: " + (e.options.fixedGutter ? i.fixedPos : - i.gutterTotalWidth) + "px"), l.firstChild);
371
- e.options.fixedGutter && (l.alignable || (l.alignable = [])).push(b), e.options.lineNumbers && (!a ||!a["CodeMirror-linenumbers"]) && (l.lineNumber = b.appendChild(cs("div", q(e.options, r), "CodeMirror-linenumber CodeMirror-gutter-elt", "left: " + i.gutterLeft["CodeMirror-linenumbers"] + "px; width: " + f.lineNumInnerWidth + "px")));
372
- if (a)
373
- for (var w = 0; w < e.options.gutters.length; ++w) {
374
- var E = e.options.gutters[w], S = a.hasOwnProperty(E) && a[E];
375
- S && b.appendChild(cs("div", [S], "CodeMirror-gutter-elt", "left: " + i.gutterLeft[E] + "px; width: " + i.gutterWidth[E] + "px"))
376
- }
377
- }
378
- n && (l.style.zIndex = 2);
379
- if (t.widgets && l != s)
380
- for (var g = 0, x = t.widgets; g < x.length; ++g) {
381
- var y = x[g], T = cs("div", [y.node], "CodeMirror-linewidget");
382
- y.handleMouseEvents || (T.ignoreEvents=!0), Q(y, T, l, i), y.above ? l.insertBefore(T, e.options.lineNumbers && t.height != 0 ? b : u) : l.appendChild(T), zi(y, "redraw")
383
- }
384
- return l
385
- }
386
- function Q(e, t, n, r) {
387
- if (e.noHScroll) {
388
- (n.alignable || (n.alignable = [])).push(t);
389
- var i = r.wrapperWidth;
390
- t.style.left = r.fixedPos + "px", e.coverGutter || (i -= r.gutterTotalWidth, t.style.paddingLeft = r.gutterTotalWidth + "px"), t.style.width = i + "px"
391
- }
392
- e.coverGutter && (t.style.zIndex = 5, t.style.position = "relative", e.noHScroll || (t.style.marginLeft =- r.gutterTotalWidth + "px"))
393
- }
394
- function G(e) {
395
- var t = e.display, n = An(e.doc.sel.from, e.doc.sel.to);
396
- n || e.options.showCursorWhenSelecting ? Y(e) : t.cursor.style.display = t.otherCursor.style.display = "none", n ? t.selectionDiv.style.display = "none" : Z(e);
397
- if (e.options.moveInputWithCursor) {
398
- var r = Et(e, e.doc.sel.head, "div"), i = vs(t.wrapper), s = vs(t.lineDiv);
399
- t.inputDiv.style.top = Math.max(0, Math.min(t.wrapper.clientHeight-10, r.top + s.top - i.top)) + "px", t.inputDiv.style.left = Math.max(0, Math.min(t.wrapper.clientWidth-10, r.left + s.left - i.left)) + "px"
400
- }
401
- }
402
- function Y(e) {
403
- var t = e.display, n = Et(e, e.doc.sel.head, "div");
404
- t.cursor.style.left = n.left + "px", t.cursor.style.top = n.top + "px", t.cursor.style.height = Math.max(0, n.bottom - n.top) * e.options.cursorHeight + "px", t.cursor.style.display = "", n.other ? (t.otherCursor.style.display = "", t.otherCursor.style.left = n.other.left + "px", t.otherCursor.style.top = n.other.top + "px", t.otherCursor.style.height = (n.other.bottom - n.other.top) * .85 + "px") : t.otherCursor.style.display = "none"
405
- }
406
- function Z(e) {
407
- function u(e, t, n, r) {
408
- t < 0 && (t = 0), i.appendChild(cs("div", null, "CodeMirror-selected", "position: absolute; left: " + e + "px; top: " + t + "px; width: " + (n == null ? s - e : n) + "px; height: " + (r - t) + "px"))
409
- }
410
- function a(t, r, i) {
411
- function h(n, r) {
412
- return wt(e, Ln(t, n), "div", a, r)
413
- }
414
- var a = hi(n, t), f = a.text.length, l, c;
415
- return Cs(bi(a), r || 0, i == null ? f : i, function(e, t, n) {
416
- var a = h(e, "left"), p, d, v;
417
- if (e == t)
418
- p = a, d = v = a.left;
419
- else {
420
- p = h(t-1, "right");
421
- if (n == "rtl") {
422
- var m = a;
423
- a = p, p = m
424
- }
425
- d = a.left, v = p.right
426
- }
427
- r == null && e == 0 && (d = o), p.top - a.top > 3 && (u(d, a.top, null, a.bottom), d = o, a.bottom < p.top && u(d, a.bottom, null, p.top)), i == null && t == f && (v = s);
428
- if (!l || a.top < l.top || a.top == l.top && a.left < l.left)
429
- l = a;
430
- if (!c || p.bottom > c.bottom || p.bottom == c.bottom && p.right > c.right)
431
- c = p;
432
- d < o + 1 && (d = o), u(d, p.top, v - d, p.bottom)
433
- }), {
434
- start: l, end: c
435
- }
436
- }
437
- var t = e.display, n = e.doc, r = e.doc.sel, i = document.createDocumentFragment(), s = t.lineSpace.offsetWidth, o = ut(e.display);
438
- if (r.from.line == r.to.line)
439
- a(r.from.line, r.from.ch, r.to.ch);
440
- else {
441
- var f = hi(n, r.from.line), l = hi(n, r.to.line), c = _r(n, f) == _r(n, l), h = a(r.from.line, r.from.ch, c ? f.text.length : null).end, p = a(r.to.line, c ? 0 : null, r.to.ch).start;
442
- c && (h.top < p.top-2 ? (u(h.right, h.top, null, h.bottom), u(o, p.top, p.left, p.bottom)) : u(h.right, h.top, p.left - h.right, h.bottom)), h.bottom < p.top && u(o, h.bottom, null, p.top)
443
- }
444
- ps(t.selectionDiv, i), t.selectionDiv.style.display = ""
445
- }
446
- function et(e) {
447
- if (!e.state.focused)
448
- return;
449
- var t = e.display;
450
- clearInterval(t.blinker);
451
- var n=!0;
452
- t.cursor.style.visibility = t.otherCursor.style.visibility = "", e.options.cursorBlinkRate > 0 && (t.blinker = setInterval(function() {
453
- t.cursor.style.visibility = t.otherCursor.style.visibility = (n=!n) ? "" : "hidden"
454
- }, e.options.cursorBlinkRate))
455
- }
456
- function tt(e, t) {
457
- e.doc.mode.startState && e.doc.frontier < e.display.showingTo && e.state.highlight.set(t, os(nt, e))
458
- }
459
- function nt(e) {
460
- var t = e.doc;
461
- t.frontier < t.first && (t.frontier = t.first);
462
- if (t.frontier >= e.display.showingTo)
463
- return;
464
- var n =+ (new Date) + e.options.workTime, r = ar(t.mode, it(e, t.frontier)), i = [], s;
465
- t.iter(t.frontier, Math.min(t.first + t.size, e.display.showingTo + 500), function(o) {
466
- if (t.frontier >= e.display.showingFrom) {
467
- var u = o.styles;
468
- o.styles = Xr(e, o, r, !0);
469
- var a=!u || u.length != o.styles.length;
470
- for (var f = 0; !a && f < u.length; ++f)
471
- a = u[f] != o.styles[f];
472
- a && (s && s.end == t.frontier ? s.end++ : i.push(s = {
473
- start: t.frontier,
474
- end: t.frontier + 1
475
- })), o.stateAfter = ar(t.mode, r)
476
- } else
477
- $r(e, o.text, r), o.stateAfter = t.frontier%5 == 0 ? ar(t.mode, r) : null;
478
- ++t.frontier;
479
- if ( + (new Date) > n)
480
- return tt(e, e.options.workDelay), !0
481
- }), i.length && Mt(e, function() {
482
- for (var e = 0; e < i.length; ++e)
483
- Pt(this, i[e].start, i[e].end)
484
- })()
485
- }
486
- function rt(e, t, n) {
487
- var r, i, s = e.doc, o = n?-1 : t - (e.doc.mode.innerMode ? 1e3 : 100);
488
- for (var u = t; u > o; --u) {
489
- if (u <= s.first)
490
- return s.first;
491
- var a = hi(s, u-1);
492
- if (a.stateAfter && (!n || u <= s.frontier))
493
- return u;
494
- var f = Gi(a.text, null, e.options.tabSize);
495
- if (i == null || r > f)
496
- i = u-1, r = f
497
- }
498
- return i
499
- }
500
- function it(e, t, n) {
501
- var r = e.doc, i = e.display;
502
- if (!r.mode.startState)
503
- return !0;
504
- var s = rt(e, t, n), o = s > r.first && hi(r, s-1).stateAfter;
505
- return o ? o = ar(r.mode, o) : o = fr(r.mode), r.iter(s, t, function(n) {
506
- $r(e, n.text, o);
507
- var u = s == t-1 || s%5 == 0 || s >= i.showingFrom && s < i.showingTo;
508
- n.stateAfter = u ? ar(r.mode, o) : null, ++s
509
- }), n && (r.frontier = s), o
510
- }
511
- function st(e) {
512
- return e.lineSpace.offsetTop
513
- }
514
- function ot(e) {
515
- return e.mover.offsetHeight - e.lineSpace.offsetHeight
516
- }
517
- function ut(e) {
518
- var t = ps(e.measure, cs("pre", null, null, "text-align: left")).appendChild(cs("span", "x"));
519
- return t.offsetLeft
520
- }
521
- function at(e, t, n, r, i) {
522
- var s =- 1;
523
- r = r || ct(e, t);
524
- if (r.crude) {
525
- var o = r.left + n * r.width;
526
- return {
527
- left: o,
528
- right: o + r.width,
529
- top: r.top,
530
- bottom: r.bottom
531
- }
532
- }
533
- for (var u = n; ; u += s) {
534
- var a = r[u];
535
- if (a)
536
- break;
537
- s < 0 && u == 0 && (s = 1)
538
- }
539
- return i = u > n ? "left" : u < n ? "right" : i, i == "left" && a.leftSide ? a = a.leftSide : i == "right" && a.rightSide && (a = a.rightSide), {
540
- left: u < n ? a.right : a.left, right: u > n ? a.left : a.right, top: a.top, bottom: a.bottom
541
- }
542
- }
543
- function ft(e, t) {
544
- var n = e.display.measureLineCache;
545
- for (var r = 0; r < n.length; ++r) {
546
- var i = n[r];
547
- if (i.text == t.text && i.markedSpans == t.markedSpans && e.display.scroller.clientWidth == i.width && i.classes == t.textClass + "|" + t.wrapClass)
548
- return i
549
- }
550
- }
551
- function lt(e, t) {
552
- var n = ft(e, t);
553
- n && (n.text = n.measure = n.markedSpans = null)
554
- }
555
- function ct(e, t) {
556
- var n = ft(e, t);
557
- if (n)
558
- return n.measure;
559
- var r = ht(e, t), i = e.display.measureLineCache, s = {
560
- text: t.text,
561
- width: e.display.scroller.clientWidth,
562
- markedSpans: t.markedSpans,
563
- measure: r,
564
- classes: t.textClass + "|" + t.wrapClass
565
- };
566
- return i.length == 16 ? i[++e.display.measureLineCachePos%16] = s : i.push(s), r
567
- }
568
- function ht(e, i) {
569
- function b(e) {
570
- var t = e.top - v.top, n = e.bottom - v.top;
571
- n > y && (n = y), t < 0 && (t = 0);
572
- for (var r = m.length-2; r >= 0; r -= 2) {
573
- var i = m[r], s = m[r + 1];
574
- if (i > n || s < t)
575
- continue;
576
- if (i <= t && s >= n || t <= i && n >= s || Math.min(n, s) - Math.max(t, i) >= n - t>>1) {
577
- m[r] = Math.min(t, i), m[r + 1] = Math.max(n, s);
578
- break
579
- }
580
- }
581
- return r < 0 && (r = m.length, m.push(t, n)), {
582
- left: e.left - v.left, right: e.right - v.left, top: r, bottom: null
583
- }
584
- }
585
- function w(e) {
586
- e.bottom = m[e.top + 1], e.top = m[e.top]
587
- }
588
- if (!e.options.lineWrapping && i.text.length >= e.options.crudeMeasuringFrom)
589
- return pt(e, i);
590
- var s = e.display, o = ss(i.text.length), u = Qr(e, i, o, !0).pre;
591
- if (t&&!n&&!e.options.lineWrapping && u.childNodes.length > 100) {
592
- var a = document.createDocumentFragment(), f = 10, l = u.childNodes.length;
593
- for (var c = 0, h = Math.ceil(l / f); c < h; ++c) {
594
- var p = cs("div", null, null, "display: inline-block");
595
- for (var d = 0; d < f && l; ++d)
596
- p.appendChild(u.firstChild), --l;
597
- a.appendChild(p)
598
- }
599
- u.appendChild(a)
600
- }
601
- ps(s.measure, u);
602
- var v = vs(s.lineDiv), m = [], g = ss(i.text.length), y = u.offsetHeight;
603
- r && s.measure.first != u && ps(s.measure, u);
604
- for (var c = 0, E; c < o.length; ++c)
605
- if (E = o[c]) {
606
- var S = E, x = null;
607
- if (/\bCodeMirror-widget\b/.test(E.className) && E.getClientRects) {
608
- E.firstChild.nodeType == 1 && (S = E.firstChild);
609
- var T = S.getClientRects();
610
- T.length > 1 && (x = g[c] = b(T[0]), x.rightSide = b(T[T.length-1]))
611
- }
612
- x || (x = g[c] = b(vs(S))), E.measureRight && (x.right = vs(E.measureRight).left), E.leftSide && (x.leftSide = b(vs(E.leftSide)))
613
- }
614
- hs(e.display.measure);
615
- for (var c = 0, E; c < g.length; ++c)
616
- if (E = g[c])
617
- w(E), E.leftSide && w(E.leftSide), E.rightSide && w(E.rightSide);
618
- return g
619
- }
620
- function pt(e, t) {
621
- var n = new Rr(t.text.slice(0, 100), null);
622
- t.textClass && (n.textClass = t.textClass);
623
- var r = ht(e, n), i = at(e, n, 0, r, "left"), s = at(e, n, 99, r, "right");
624
- return {
625
- crude: !0,
626
- top: i.top,
627
- left: i.left,
628
- bottom: i.bottom,
629
- width: (s.right - i.left) / 100
630
- }
631
- }
632
- function dt(e, t) {
633
- var n=!1;
634
- if (t.markedSpans)
635
- for (var r = 0; r < t.markedSpans; ++r) {
636
- var i = t.markedSpans[r];
637
- i.collapsed && (i.to == null || i.to == t.text.length) && (n=!0)
638
- }
639
- var s=!n && ft(e, t);
640
- if (s || t.text.length >= e.options.crudeMeasuringFrom)
641
- return at(e, t, t.text.length, s && s.measure, "right").right;
642
- var o = Qr(e, t, null, !0).pre, u = o.appendChild(Es(e.display.measure));
643
- return ps(e.display.measure, o), vs(u).right - vs(e.display.lineDiv).left
644
- }
645
- function vt(e) {
646
- e.display.measureLineCache.length = e.display.measureLineCachePos = 0, e.display.cachedCharWidth = e.display.cachedTextHeight = null, e.options.lineWrapping || (e.display.maxLineChanged=!0), e.display.lineNumChars = null
647
- }
648
- function mt() {
649
- return window.pageXOffset || (document.documentElement || document.body).scrollLeft
650
- }
651
- function gt() {
652
- return window.pageYOffset || (document.documentElement || document.body).scrollTop
653
- }
654
- function yt(e, t, n, r) {
655
- if (t.widgets)
656
- for (var i = 0; i < t.widgets.length; ++i)
657
- if (t.widgets[i].above) {
658
- var s = Ir(t.widgets[i]);
659
- n.top += s, n.bottom += s
660
- }
661
- if (r == "line")
662
- return n;
663
- r || (r = "local");
664
- var o = yi(e, t);
665
- r == "local" ? o += st(e.display) : o -= e.display.viewOffset;
666
- if (r == "page" || r == "window") {
667
- var u = vs(e.display.lineSpace);
668
- o += u.top + (r == "window" ? 0 : gt());
669
- var a = u.left + (r == "window" ? 0 : mt());
670
- n.left += a, n.right += a
671
- }
672
- return n.top += o, n.bottom += o, n
673
- }
674
- function bt(e, t, n) {
675
- if (n == "div")
676
- return t;
677
- var r = t.left, i = t.top;
678
- if (n == "page")
679
- r -= mt(), i -= gt();
680
- else if (n == "local" ||!n) {
681
- var s = vs(e.display.sizer);
682
- r += s.left, i += s.top
683
- }
684
- var o = vs(e.display.lineSpace);
685
- return {
686
- left: r - o.left,
687
- top: i - o.top
688
- }
689
- }
690
- function wt(e, t, n, r, i) {
691
- return r || (r = hi(e.doc, t.line)), yt(e, r, at(e, r, t.ch, null, i), n)
692
- }
693
- function Et(e, t, n, r, i) {
694
- function s(t, s) {
695
- var o = at(e, r, t, i, s ? "right" : "left");
696
- return s ? o.left = o.right : o.right = o.left, yt(e, r, o, n)
697
- }
698
- function o(e, t) {
699
- var n = u[t], r = n.level%2;
700
- return e == ks(n) && t && n.level < u[t-1].level ? (n = u[--t], e = Ls(n) - (n.level%2 ? 0 : 1), r=!0) : e == Ls(n) && t < u.length-1 && n.level < u[t + 1].level && (n = u[++t], e = ks(n) - n.level%2, r=!1), r && e == n.to && e > n.from ? s(e-1) : s(e, r)
701
- }
702
- r = r || hi(e.doc, t.line), i || (i = ct(e, r));
703
- var u = bi(r), a = t.ch;
704
- if (!u)
705
- return s(a);
706
- var f = Hs(u, a), l = o(a, f);
707
- return Ps != null && (l.other = o(a, Ps)), l
708
- }
709
- function St(e, t, n, r) {
710
- var i = new Ln(e, t);
711
- return i.xRel = r, n && (i.outside=!0), i
712
- }
713
- function xt(e, t, n) {
714
- var r = e.doc;
715
- n += e.display.viewOffset;
716
- if (n < 0)
717
- return St(r.first, 0, !0, -1);
718
- var i = gi(r, n), s = r.first + r.size-1;
719
- if (i > s)
720
- return St(r.first + r.size-1, hi(r, s).text.length, !0, 1);
721
- t < 0 && (t = 0);
722
- for (; ;) {
723
- var o = hi(r, i), u = Tt(e, o, i, t, n), a = Mr(o), f = a && a.find();
724
- if (!a ||!(u.ch > f.from.ch || u.ch == f.from.ch && u.xRel > 0))
725
- return u;
726
- i = f.to.line
727
- }
728
- }
729
- function Tt(e, t, n, r, i) {
730
- function f(r) {
731
- var i = Et(e, Ln(n, r), "line", t, a);
732
- return o=!0, s > i.bottom ? i.left - u : s < i.top ? i.left + u : (o=!1, i.left)
733
- }
734
- var s = i - yi(e, t), o=!1, u = 2 * e.display.wrapper.clientWidth, a = ct(e, t), l = bi(t), c = t.text.length, h = As(t), p = Os(t), d = f(h), v = o, m = f(p), g = o;
735
- if (r > m)
736
- return St(n, p, g, 1);
737
- for (; ;) {
738
- if (l ? p == h || p == js(t, h, 1) : p - h <= 1) {
739
- var y = r < d || r - d <= m - r ? h: p, b = r - (y == h ? d : m);
740
- while (ls.test(t.text.charAt(y)))++y;
741
- var w = St(n, y, y == h ? v : g, b < 0?-1 : b ? 1 : 0);
742
- return w
743
- }
744
- var E = Math.ceil(c / 2), S = h + E;
745
- if (l) {
746
- S = h;
747
- for (var x = 0; x < E; ++x)
748
- S = js(t, S, 1)
749
- }
750
- var T = f(S);
751
- if (T > r) {
752
- p = S, m = T;
753
- if (g = o)
754
- m += 1e3;
755
- c = E
756
- } else
757
- h = S, d = T, v = o, c -= E
758
- }
759
- }
760
- function Ct(e) {
761
- if (e.cachedTextHeight != null)
762
- return e.cachedTextHeight;
763
- if (Nt == null) {
764
- Nt = cs("pre");
765
- for (var t = 0; t < 49; ++t)
766
- Nt.appendChild(document.createTextNode("x")), Nt.appendChild(cs("br"));
767
- Nt.appendChild(document.createTextNode("x"))
768
- }
769
- ps(e.measure, Nt);
770
- var n = Nt.offsetHeight / 50;
771
- return n > 3 && (e.cachedTextHeight = n), hs(e.measure), n || 1
772
- }
773
- function kt(e) {
774
- if (e.cachedCharWidth != null)
775
- return e.cachedCharWidth;
776
- var t = cs("span", "x"), n = cs("pre", [t]);
777
- ps(e.measure, n);
778
- var r = t.offsetWidth;
779
- return r > 2 && (e.cachedCharWidth = r), r || 10
780
- }
781
- function At(e) {
782
- e.curOp = {
783
- changes: [],
784
- forceUpdate: !1,
785
- updateInput: null,
786
- userSelChange: null,
787
- textChanged: null,
788
- selectionChanged: !1,
789
- cursorActivity: !1,
790
- updateMaxLine: !1,
791
- updateScrollPos: !1,
792
- id: ++Lt
793
- }, Ui++||(Ri = [])
794
- }
795
- function Ot(e) {
796
- var t = e.curOp, n = e.doc, r = e.display;
797
- e.curOp = null, t.updateMaxLine && P(e);
798
- if (r.maxLineChanged&&!e.options.lineWrapping && r.maxLine) {
799
- var i = dt(e, r.maxLine);
800
- r.sizer.style.minWidth = Math.max(0, i + 3 + Ji) + "px", r.maxLineChanged=!1;
801
- var s = Math.max(0, r.sizer.offsetLeft + r.sizer.offsetWidth - r.scroller.clientWidth);
802
- s < n.scrollLeft&&!t.updateScrollPos && en(e, Math.min(r.scroller.scrollLeft, s), !0)
803
- }
804
- var o, u;
805
- if (t.updateScrollPos)
806
- o = t.updateScrollPos;
807
- else if (t.selectionChanged && r.scroller.clientHeight) {
808
- var a = Et(e, n.sel.head);
809
- o = Wn(e, a.left, a.top, a.left, a.bottom)
810
- }
811
- if (t.changes.length || t.forceUpdate || o && o.scrollTop != null)
812
- u = U(e, t.changes, o && o.scrollTop, t.forceUpdate), e.display.scroller.offsetHeight && (e.doc.scrollTop = e.display.scroller.scrollTop);
813
- !u && t.selectionChanged && G(e);
814
- if (t.updateScrollPos) {
815
- var f = Math.max(0, Math.min(r.scroller.scrollHeight - r.scroller.clientHeight, o.scrollTop)), l = Math.max(0, Math.min(r.scroller.scrollWidth - r.scroller.clientWidth, o.scrollLeft));
816
- r.scroller.scrollTop = r.scrollbarV.scrollTop = n.scrollTop = f, r.scroller.scrollLeft = r.scrollbarH.scrollLeft = n.scrollLeft = l, F(e), t.scrollToPos && Un(e, Dn(e.doc, t.scrollToPos.from), Dn(e.doc, t.scrollToPos.to), t.scrollToPos.margin)
817
- } else
818
- o && Rn(e);
819
- t.selectionChanged && et(e), e.state.focused && t.updateInput && Ft(e, t.userSelChange);
820
- var c = t.maybeHiddenMarkers, h = t.maybeUnhiddenMarkers;
821
- if (c)
822
- for (var p = 0; p < c.length; ++p)
823
- c[p].lines.length || qi(c[p], "hide");
824
- if (h)
825
- for (var p = 0; p < h.length; ++p)
826
- h[p].lines.length && qi(h[p], "unhide");
827
- var d;
828
- --Ui || (d = Ri, Ri = null), t.textChanged && qi(e, "change", e, t.textChanged), t.cursorActivity && qi(e, "cursorActivity", e);
829
- if (d)
830
- for (var p = 0; p < d.length; ++p)
831
- d[p]()
832
- }
833
- function Mt(e, t) {
834
- return function() {
835
- var n = e || this, r=!n.curOp;
836
- r && At(n);
837
- try {
838
- var i = t.apply(n, arguments)
839
- } finally {
840
- r && Ot(n)
841
- }
842
- return i
843
- }
844
- }
845
- function _t(e) {
846
- return function() {
847
- var t = this.cm&&!this.cm.curOp, n;
848
- t && At(this.cm);
849
- try {
850
- n = e.apply(this, arguments)
851
- } finally {
852
- t && Ot(this.cm)
853
- }
854
- return n
855
- }
856
- }
857
- function Dt(e, t) {
858
- var n=!e.curOp, r;
859
- n && At(e);
860
- try {
861
- r = t()
862
- } finally {
863
- n && Ot(e)
864
- }
865
- return r
866
- }
867
- function Pt(e, t, n, r) {
868
- t == null && (t = e.doc.first), n == null && (n = e.doc.first + e.doc.size), e.curOp.changes.push({
869
- from: t,
870
- to: n,
871
- diff: r
872
- })
873
- }
874
- function Ht(e) {
875
- if (e.display.pollingFast)
876
- return;
877
- e.display.poll.set(e.options.pollInterval, function() {
878
- jt(e), e.state.focused && Ht(e)
879
- })
880
- }
881
- function Bt(e) {
882
- function n() {
883
- var r = jt(e);
884
- !r&&!t ? (t=!0, e.display.poll.set(60, n)) : (e.display.pollingFast=!1, Ht(e))
885
- }
886
- var t=!1;
887
- e.display.pollingFast=!0, e.display.poll.set(20, n)
888
- }
889
- function jt(e) {
890
- var n = e.display.input, i = e.display.prevInput, s = e.doc, o = s.sel;
891
- if (!e.state.focused || xs(n) || qt(e) || e.state.disableInput)
892
- return !1;
893
- e.state.pasteIncoming && e.state.fakedLastChar && (n.value = n.value.substring(0, n.value.length-1), e.state.fakedLastChar=!1);
894
- var u = n.value;
895
- if (u == i && An(o.from, o.to))
896
- return !1;
897
- if (t&&!r && e.display.inputHasSelection === u)
898
- return Ft(e, !0), !1;
899
- var a=!e.curOp;
900
- a && At(e), o.shift=!1;
901
- var f = 0, l = Math.min(i.length, u.length);
902
- while (f < l && i.charCodeAt(f) == u.charCodeAt(f))++f;
903
- var c = o.from, h = o.to;
904
- f < i.length ? c = Ln(c.line, c.ch - (i.length - f)) : e.state.overwrite && An(c, h)&&!e.state.pasteIncoming && (h = Ln(h.line, Math.min(hi(s, h.line).text.length, h.ch + (u.length - f))));
905
- var p = e.curOp.updateInput, d = {
906
- from: c,
907
- to: h,
908
- text: Ss(u.slice(f)),
909
- origin: e.state.pasteIncoming ? "paste": "+input"
910
- };
911
- return En(e.doc, d, "end"), e.curOp.updateInput = p, zi(e, "inputRead", e, d), u.length > 1e3 || u.indexOf("\n")>-1 ? n.value = e.display.prevInput = "" : e.display.prevInput = u, a && Ot(e), e.state.pasteIncoming=!1, !0
912
- }
913
- function Ft(e, n) {
914
- var i, s, o = e.doc;
915
- if (!An(o.sel.from, o.sel.to)) {
916
- e.display.prevInput = "", i = Ts && (o.sel.to.line - o.sel.from.line > 100 || (s = e.getSelection()).length > 1e3);
917
- var u = i ? "-": s || e.getSelection();
918
- e.display.input.value = u, e.state.focused && ts(e.display.input), t&&!r && (e.display.inputHasSelection = u)
919
- } else
920
- n && (e.display.prevInput = e.display.input.value = "", t&&!r && (e.display.inputHasSelection = null));
921
- e.display.inaccurateSelection = i
922
- }
923
- function It(e) {
924
- e.options.readOnly != "nocursor" && (!v || document.activeElement != e.display.input) && e.display.input.focus()
925
- }
926
- function qt(e) {
927
- return e.options.readOnly || e.doc.cantEdit
928
- }
929
- function Rt(e) {
930
- function i() {
931
- e.state.focused && setTimeout(os(It, e), 0)
932
- }
933
- function u() {
934
- o == null && (o = setTimeout(function() {
935
- o = null, n.cachedCharWidth = n.cachedTextHeight = ys = null, vt(e), Dt(e, os(Pt, e))
936
- }, 100))
937
- }
938
- function a() {
939
- for (var e = n.wrapper.parentNode; e && e != document.body; e = e.parentNode);
940
- e ? setTimeout(a, 5e3) : Ii(window, "resize", u)
941
- }
942
- function f(t) {
943
- if (Wi(e, t) || e.options.onDragEvent && e.options.onDragEvent(e, Mi(t)))
944
- return;
945
- Hi(t)
946
- }
947
- function c() {
948
- n.inaccurateSelection && (n.prevInput = "", n.inaccurateSelection=!1, n.input.value = e.getSelection(), ts(n.input))
949
- }
950
- var n = e.display;
951
- Fi(n.scroller, "mousedown", Mt(e, Vt)), t ? Fi(n.scroller, "dblclick", Mt(e, function(t) {
952
- if (Wi(e, t))
953
- return;
954
- var n = zt(e, t);
955
- if (!n || Kt(e, t) || Ut(e.display, t))
956
- return;
957
- _i(t);
958
- var r = Gn(hi(e.doc, n.line).text, n);
959
- Bn(e.doc, r.from, r.to)
960
- })) : Fi(n.scroller, "dblclick", function(t) {
961
- Wi(e, t) || _i(t)
962
- }), Fi(n.lineSpace, "selectstart", function(e) {
963
- Ut(n, e) || _i(e)
964
- }), w || Fi(n.scroller, "contextmenu", function(t) {
965
- mn(e, t)
966
- }), Fi(n.scroller, "scroll", function() {
967
- n.scroller.clientHeight && (Zt(e, n.scroller.scrollTop), en(e, n.scroller.scrollLeft, !0), qi(e, "scroll", e))
968
- }), Fi(n.scrollbarV, "scroll", function() {
969
- n.scroller.clientHeight && Zt(e, n.scrollbarV.scrollTop)
970
- }), Fi(n.scrollbarH, "scroll", function() {
971
- n.scroller.clientHeight && en(e, n.scrollbarH.scrollLeft)
972
- }), Fi(n.scroller, "mousewheel", function(t) {
973
- rn(e, t)
974
- }), Fi(n.scroller, "DOMMouseScroll", function(t) {
975
- rn(e, t)
976
- }), Fi(n.scrollbarH, "mousedown", i), Fi(n.scrollbarV, "mousedown", i), Fi(n.wrapper, "scroll", function() {
977
- n.wrapper.scrollTop = n.wrapper.scrollLeft = 0
978
- });
979
- var o;
980
- Fi(window, "resize", u), setTimeout(a, 5e3), Fi(n.input, "keyup", Mt(e, function(t) {
981
- if (Wi(e, t) || e.options.onKeyEvent && e.options.onKeyEvent(e, Mi(t)))
982
- return;
983
- t.keyCode == 16 && (e.doc.sel.shift=!1)
984
- })), Fi(n.input, "input", function() {
985
- t&&!r && e.display.inputHasSelection && (e.display.inputHasSelection = null), Bt(e)
986
- }), Fi(n.input, "keydown", Mt(e, cn)), Fi(n.input, "keypress", Mt(e, hn)), Fi(n.input, "focus", os(pn, e)), Fi(n.input, "blur", os(dn, e)), e.options.dragDrop && (Fi(n.scroller, "dragstart", function(t) {
987
- Yt(e, t)
988
- }), Fi(n.scroller, "dragenter", f), Fi(n.scroller, "dragover", f), Fi(n.scroller, "drop", Mt(e, Gt))), Fi(n.scroller, "paste", function(t) {
989
- if (Ut(n, t))
990
- return;
991
- It(e), Bt(e)
992
- }), Fi(n.input, "paste", function() {
993
- if (s&&!e.state.fakedLastChar&&!(new Date - e.state.lastMiddleDown < 200)) {
994
- var t = n.input.selectionStart, r = n.input.selectionEnd;
995
- n.input.value += "$", n.input.selectionStart = t, n.input.selectionEnd = r, e.state.fakedLastChar=!0
996
- }
997
- e.state.pasteIncoming=!0, Bt(e)
998
- }), Fi(n.input, "cut", c), Fi(n.input, "copy", c), l && Fi(n.sizer, "mouseup", function() {
999
- document.activeElement == n.input && n.input.blur(), It(e)
1000
- })
1001
- }
1002
- function Ut(e, t) {
1003
- for (var n = Bi(t); n != e.wrapper; n = n.parentNode)
1004
- if (!n || n.ignoreEvents || n.parentNode == e.sizer && n != e.mover)
1005
- return !0
1006
- }
1007
- function zt(e, t, n) {
1008
- var r = e.display;
1009
- if (!n) {
1010
- var i = Bi(t);
1011
- if (i == r.scrollbarH || i == r.scrollbarH.firstChild || i == r.scrollbarV || i == r.scrollbarV.firstChild || i == r.scrollbarFiller || i == r.gutterFiller)
1012
- return null
1013
- }
1014
- var s, o, u = vs(r.lineSpace);
1015
- try {
1016
- s = t.clientX, o = t.clientY
1017
- } catch (t) {
1018
- return null
1019
- }
1020
- return xt(e, s - u.left, o - u.top)
1021
- }
1022
- function Vt(e) {
1023
- function m(e) {
1024
- if (An(v, e))
1025
- return;
1026
- v = e;
1027
- if (f == "single") {
1028
- Bn(n.doc, Dn(i, u), e);
1029
- return
1030
- }
1031
- p = Dn(i, p), d = Dn(i, d);
1032
- if (f == "double") {
1033
- var t = Gn(hi(i, e.line).text, e);
1034
- On(e, p) ? Bn(n.doc, t.from, d) : Bn(n.doc, p, t.to)
1035
- } else
1036
- f == "triple" && (On(e, p) ? Bn(n.doc, d, Dn(i, Ln(e.line, 0))) : Bn(n.doc, p, Dn(i, Ln(e.line + 1, 0))))
1037
- }
1038
- function b(e) {
1039
- var t=++y, s = zt(n, e, !0);
1040
- if (!s)
1041
- return;
1042
- if (!An(s, c)) {
1043
- n.state.focused || pn(n), c = s, m(s);
1044
- var o = j(r, i);
1045
- (s.line >= o.to || s.line < o.from) && setTimeout(Mt(n, function() {
1046
- y == t && b(e)
1047
- }), 150)
1048
- } else {
1049
- var u = e.clientY < g.top?-20 : e.clientY > g.bottom ? 20 : 0;
1050
- u && setTimeout
1051
- (Mt(n, function() {
1052
- if (y != t)
1053
- return;
1054
- r.scroller.scrollTop += u, b(e)
1055
- }), 50)
1056
- }
1057
- }
1058
- function E(e) {
1059
- y = Infinity, _i(e), It(n), Ii(document, "mousemove", S), Ii(document, "mouseup", x)
1060
- }
1061
- if (Wi(this, e))
1062
- return;
1063
- var n = this, r = n.display, i = n.doc, o = i.sel;
1064
- o.shift = e.shiftKey;
1065
- if (Ut(r, e)) {
1066
- s || (r.scroller.draggable=!1, setTimeout(function() {
1067
- r.scroller.draggable=!0
1068
- }, 100));
1069
- return
1070
- }
1071
- if (Kt(n, e))
1072
- return;
1073
- var u = zt(n, e);
1074
- switch (ji(e)) {
1075
- case 3:
1076
- w && mn.call(n, n, e);
1077
- return;
1078
- case 2:
1079
- s && (n.state.lastMiddleDown =+ (new Date)), u && Bn(n.doc, u), setTimeout(os(It, n), 20), _i(e);
1080
- return
1081
- }
1082
- if (!u) {
1083
- Bi(e) == r.scroller && _i(e);
1084
- return
1085
- }
1086
- n.state.focused || pn(n);
1087
- var a =+ (new Date), f = "single";
1088
- if (Xt && Xt.time > a-400 && An(Xt.pos, u)
1089
- )f = "triple", _i(e), setTimeout(os(It, n), 20), Yn(n, u.line);
1090
- else if (Wt && Wt.time > a-400 && An(Wt.pos, u)
1091
- ) {
1092
- f = "double", Xt = {
1093
- time: a,
1094
- pos: u
1095
- }, _i(e);
1096
- var l = Gn(hi(i, u.line).text, u);
1097
- Bn(n.doc, l.from, l.to)
1098
- } else
1099
- Wt = {
1100
- time: a,
1101
- pos: u
1102
- };
1103
- var c = u;
1104
- if (n.options.dragDrop && ms&&!qt(n)&&!An(o.from, o.to)&&!On(u, o.from)&&!On(o.to, u) && f == "single") {
1105
- var h = Mt(n, function(t) {
1106
- s && (r.scroller.draggable=!1), n.state.draggingText=!1, Ii(document, "mouseup", h), Ii(r.scroller, "drop", h), Math.abs(e.clientX - t.clientX) + Math.abs(e.clientY - t.clientY) < 10 && (_i(t), Bn(n.doc, u), It(n))
1107
- });
1108
- s && (r.scroller.draggable=!0), n.state.draggingText = h, r.scroller.dragDrop && r.scroller.dragDrop(), Fi(document, "mouseup", h), Fi(r.scroller, "drop", h);
1109
- return
1110
- }
1111
- _i(e), f == "single" && Bn(n.doc, Dn(i, u));
1112
- var p = o.from, d = o.to, v = u, g = vs(r.wrapper), y = 0, S = Mt(n, function(e) {
1113
- !t&&!ji(e) ? E(e) : b(e)
1114
- }), x = Mt(n, E);
1115
- Fi(document, "mousemove", S), Fi(document, "mouseup", x)
1116
- }
1117
- function $t(e, t, n, r, i) {
1118
- try {
1119
- var s = t.clientX, o = t.clientY
1120
- } catch (t) {
1121
- return !1
1122
- }
1123
- if (s >= Math.floor(vs(e.display.gutters).right))
1124
- return !1;
1125
- r && _i(t);
1126
- var u = e.display, a = vs(u.lineDiv);
1127
- if (o > a.bottom ||!Vi(e, n))
1128
- return Pi(t);
1129
- o -= a.top - u.viewOffset;
1130
- for (var f = 0; f < e.options.gutters.length; ++f) {
1131
- var l = u.gutters.childNodes[f];
1132
- if (l && vs(l).right >= s) {
1133
- var c = gi(e.doc, o), h = e.options.gutters[f];
1134
- return i(e, n, e, c, h, t), Pi(t)
1135
- }
1136
- }
1137
- }
1138
- function Jt(e, t) {
1139
- return Vi(e, "gutterContextMenu") ? $t(e, t, "gutterContextMenu", !1, qi) : !1
1140
- }
1141
- function Kt(e, t) {
1142
- return $t(e, t, "gutterClick", !0, zi)
1143
- }
1144
- function Gt(e) {
1145
- var n = this;
1146
- if (Wi(n, e) || Ut(n.display, e) || n.options.onDragEvent && n.options.onDragEvent(n, Mi(e)))
1147
- return;
1148
- _i(e), t && (Qt =+ (new Date));
1149
- var r = zt(n, e, !0), i = e.dataTransfer.files;
1150
- if (!r || qt(n))
1151
- return;
1152
- if (i && i.length && window.FileReader && window.File) {
1153
- var s = i.length, o = Array(s), u = 0, a = function(e, t) {
1154
- var i = new FileReader;
1155
- i.onload = function() {
1156
- o[t] = i.result, ++u == s && (r = Dn(n.doc, r), En(n.doc, {
1157
- from : r, to : r, text : Ss(o.join("\n")), origin: "paste"
1158
- }, "around"))
1159
- }, i.readAsText(e)
1160
- };
1161
- for (var f = 0; f < s; ++f)
1162
- a(i[f], f)
1163
- } else {
1164
- if (n.state.draggingText&&!On(r, n.doc.sel.from)&&!On(n.doc.sel.to, r)) {
1165
- n.state.draggingText(e), setTimeout(os(It, n), 20);
1166
- return
1167
- }
1168
- try {
1169
- var o = e.dataTransfer.getData("Text");
1170
- if (o) {
1171
- var l = n.doc.sel.from, c = n.doc.sel.to;
1172
- Fn(n.doc, r, r), n.state.draggingText && kn(n.doc, "", l, c, "paste"), n.replaceSelection(o, null, "paste"), It(n)
1173
- }
1174
- } catch (e) {}
1175
- }
1176
- }
1177
- function Yt(e, n) {
1178
- if (t && (!e.state.draggingText||+(new Date) - Qt < 100)) {
1179
- Hi(n);
1180
- return
1181
- }
1182
- if (Wi(e, n) || Ut(e.display, n))
1183
- return;
1184
- var r = e.getSelection();
1185
- n.dataTransfer.setData("Text", r);
1186
- if (n.dataTransfer.setDragImage&&!f) {
1187
- var i = cs("img", null, null, "position: fixed; left: 0; top: 0;");
1188
- i.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", a && (i.width = i.height = 1, e.display.wrapper.appendChild(i), i._top = i.offsetTop), n.dataTransfer.setDragImage(i, 0, 0), a && i.parentNode.removeChild(i)
1189
- }
1190
- }
1191
- function Zt(t, n) {
1192
- if (Math.abs(t.doc.scrollTop - n) < 2)
1193
- return;
1194
- t.doc.scrollTop = n, e || U(t, [], n), t.display.scroller.scrollTop != n && (t.display.scroller.scrollTop = n), t.display.scrollbarV.scrollTop != n && (t.display.scrollbarV.scrollTop = n), e && U(t, []), tt(t, 100)
1195
- }
1196
- function en(e, t, n) {
1197
- if (n ? t == e.doc.scrollLeft : Math.abs(e.doc.scrollLeft - t) < 2)
1198
- return;
1199
- t = Math.min(t, e.display.scroller.scrollWidth - e.display.scroller.clientWidth), e.doc.scrollLeft = t, F(e), e.display.scroller.scrollLeft != t && (e.display.scroller.scrollLeft = t), e.display.scrollbarH.scrollLeft != t && (e.display.scrollbarH.scrollLeft = t)
1200
- }
1201
- function rn(t, n) {
1202
- var r = n.wheelDeltaX, i = n.wheelDeltaY;
1203
- r == null && n.detail && n.axis == n.HORIZONTAL_AXIS && (r = n.detail), i == null && n.detail && n.axis == n.VERTICAL_AXIS ? i = n.detail : i == null && (i = n.wheelDelta);
1204
- var o = t.display, u = o.scroller;
1205
- if (!(r && u.scrollWidth > u.clientWidth || i && u.scrollHeight > u.clientHeight))
1206
- return;
1207
- if (i && m && s)
1208
- for (var f = n.target; f != u; f = f.parentNode)
1209
- if (f.lineObj) {
1210
- t.display.currentWheelTarget = f;
1211
- break
1212
- }
1213
- if (r&&!e&&!a && nn != null) {
1214
- i && Zt(t, Math.max(0, Math.min(u.scrollTop + i * nn, u.scrollHeight - u.clientHeight))), en(t, Math.max(0, Math.min(u.scrollLeft + r * nn, u.scrollWidth - u.clientWidth))), _i(n), o.wheelStartX = null;
1215
- return
1216
- }
1217
- if (i && nn != null) {
1218
- var l = i * nn, c = t.doc.scrollTop, h = c + o.wrapper.clientHeight;
1219
- l < 0 ? c = Math.max(0, c + l-50) : h = Math.min(t.doc.height, h + l + 50), U(t, [], {
1220
- top: c,
1221
- bottom: h
1222
- })
1223
- }
1224
- tn < 20 && (o.wheelStartX == null ? (o.wheelStartX = u.scrollLeft, o.wheelStartY = u.scrollTop, o.wheelDX = r, o.wheelDY = i, setTimeout(function() {
1225
- if (o.wheelStartX == null)return; var e = u.scrollLeft - o.wheelStartX, t = u.scrollTop - o.wheelStartY, n = t && o.wheelDY && t / o.wheelDY || e && o.wheelDX && e / o.wheelDX; o.wheelStartX = o.wheelStartY = null; if (!n)return; nn = (nn * tn + n) / (tn + 1), ++tn
1226
- }, 200)) : (o.wheelDX += r, o.wheelDY += i))
1227
- }
1228
- function sn(e, t, n) {
1229
- if (typeof t == "string") {
1230
- t = lr[t];
1231
- if (!t)
1232
- return !1
1233
- }
1234
- e.display.pollingFast && jt(e) && (e.display.pollingFast=!1);
1235
- var r = e.doc, i = r.sel.shift, s=!1;
1236
- try {
1237
- qt(e) && (e.state.suppressEdits=!0), n && (r.sel.shift=!1), s = t(e) != Ki
1238
- } finally {
1239
- r.sel.shift = i, e.state.suppressEdits=!1
1240
- }
1241
- return s
1242
- }
1243
- function on(e) {
1244
- var t = e.state.keyMaps.slice(0);
1245
- return e.options.extraKeys && t.push(e.options.extraKeys), t.push(e.options.keyMap), t
1246
- }
1247
- function an(e, t) {
1248
- var n = hr(e.options.keyMap), i = n.auto;
1249
- clearTimeout(un), i&&!dr(t) && (un = setTimeout(function() {
1250
- hr(e.options.keyMap) == n && (e.options.keyMap = i.call ? i.call(null, e) : i, A(e))
1251
- }, 50));
1252
- var s = vr(t, !0), o=!1;
1253
- if (!s)
1254
- return !1;
1255
- var u = on(e);
1256
- return t.shiftKey ? o = pr("Shift-" + s, u, function(t) {
1257
- return sn(e, t, !0)
1258
- }) || pr(s, u, function(t) {
1259
- if (typeof t == "string" ? /^go[A-Z]/.test(t) : t.motion)
1260
- return sn(e, t)
1261
- }) : o = pr(s, u, function(t) {
1262
- return sn(e, t)
1263
- }), o && (_i(t), et(e), r && (t.oldKeyCode = t.keyCode, t.keyCode = 0), zi(e, "keyHandled", e, s, t)), o
1264
- }
1265
- function fn(e, t, n) {
1266
- var r = pr("'" + n + "'", on(e), function(t) {
1267
- return sn(e, t, !0)
1268
- });
1269
- return r && (_i(t), et(e), zi(e, "keyHandled", e, "'" + n + "'", t)), r
1270
- }
1271
- function cn(e) {
1272
- var n = this;
1273
- n.state.focused || pn(n);
1274
- if (Wi(n, e) || n.options.onKeyEvent && n.options.onKeyEvent(n, Mi(e)))
1275
- return;
1276
- t && e.keyCode == 27 && (e.returnValue=!1);
1277
- var r = e.keyCode;
1278
- n.doc.sel.shift = r == 16 || e.shiftKey;
1279
- var i = an(n, e);
1280
- a && (ln = i ? r : null, !i && r == 88&&!Ts && (m ? e.metaKey : e.ctrlKey) && n.replaceSelection(""))
1281
- }
1282
- function hn(e) {
1283
- var n = this;
1284
- if (Wi(n, e) || n.options.onKeyEvent && n.options.onKeyEvent(n, Mi(e)))
1285
- return;
1286
- var i = e.keyCode, s = e.charCode;
1287
- if (a && i == ln) {
1288
- ln = null, _i(e);
1289
- return
1290
- }
1291
- if ((a && (!e.which || e.which < 10) || l) && an(n, e))
1292
- return;
1293
- var o = String.fromCharCode(s == null ? i : s);
1294
- this.options.electricChars && this.doc.mode.electricChars && this.options.smartIndent&&!qt(this) && this.doc.mode.electricChars.indexOf(o)>-1 && setTimeout(Mt(n, function() {
1295
- $n(n, n.doc.sel.to.line, "smart")
1296
- }), 75);
1297
- if (fn(n, e, o))
1298
- return;
1299
- t&&!r && (n.display.inputHasSelection = null), Bt(n)
1300
- }
1301
- function pn(e) {
1302
- if (e.options.readOnly == "nocursor")
1303
- return;
1304
- e.state.focused || (qi(e, "focus", e), e.state.focused=!0, e.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1 && (e.display.wrapper.className += " CodeMirror-focused"), e.curOp || (Ft(e, !0), s && setTimeout(os(Ft, e, !0), 0))), Ht(e), et(e)
1305
- }
1306
- function dn(e) {
1307
- e.state.focused && (qi(e, "blur", e), e.state.focused=!1, e.display.wrapper.className = e.display.wrapper.className.replace(" CodeMirror-focused", "")), clearInterval(e.display.blinker), setTimeout(function() {
1308
- e.state.focused || (e.doc.sel.shift=!1)
1309
- }, 150)
1310
- }
1311
- function mn(e, n) {
1312
- function c() {
1313
- if (i.input.selectionStart != null) {
1314
- var e = i.input.value = "​" + (An(s.from, s.to) ? "" : i.input.value);
1315
- i.prevInput = "​", i.input.selectionStart = 1, i.input.selectionEnd = e.length
1316
- }
1317
- }
1318
- function h() {
1319
- i.inputDiv.style.position = "relative", i.input.style.cssText = l, r && (i.scrollbarV.scrollTop = i.scroller.scrollTop = u), Ht(e);
1320
- if (i.input.selectionStart != null) {
1321
- (!t || r) && c(), clearTimeout(vn);
1322
- var n = 0, s = function() {
1323
- i.prevInput == " " && i.input.selectionStart == 0 ? Mt(e, lr.selectAll)(e) : n++<10 ? vn = setTimeout(s, 500) : Ft(e)
1324
- };
1325
- vn = setTimeout(s, 200)
1326
- }
1327
- }
1328
- if (Wi(e, n, "contextmenu"))
1329
- return;
1330
- var i = e.display, s = e.doc.sel;
1331
- if (Ut(i, n) || Jt(e, n))
1332
- return;
1333
- var o = zt(e, n), u = i.scroller.scrollTop;
1334
- if (!o || a)
1335
- return;
1336
- var f = e.options.resetSelectionOnContextMenu;
1337
- f && (An(s.from, s.to) || On(o, s.from) ||!On(o, s.to)) && Mt(e, Fn)(e.doc, o, o);
1338
- var l = i.input.style.cssText;
1339
- i.inputDiv.style.position = "absolute", i.input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (n.clientY-5) + "px; left: " + (n.clientX-5) + "px; z-index: 1000; background: white; outline: none;" + "border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);", It(e), Ft(e, !0), An(s.from, s.to) && (i.input.value = i.prevInput = " "), t&&!r && c();
1340
- if (w) {
1341
- Hi(n);
1342
- var p = function() {
1343
- Ii(window, "mouseup", p), setTimeout(h, 20)
1344
- };
1345
- Fi(window, "mouseup", p)
1346
- } else
1347
- setTimeout(h, 50)
1348
- }
1349
- function yn(e, t, n) {
1350
- if (!On(t.from, n))
1351
- return Dn(e, n);
1352
- var r = t.text.length-1 - (t.to.line - t.from.line);
1353
- if (n.line > t.to.line + r) {
1354
- var i = n.line - r, s = e.first + e.size-1;
1355
- return i > s ? Ln(s, hi(e, s).text.length) : Pn(n, hi(e, i).text.length)
1356
- }
1357
- if (n.line == t.to.line + r)
1358
- return Pn(n, es(t.text).length + (t.text.length == 1 ? t.from.ch : 0) + hi(e, t.to.line).text.length - t.to.ch);
1359
- var o = n.line - t.from.line;
1360
- return Pn(n, t.text[o].length + (o ? 0 : t.from.ch))
1361
- }
1362
- function bn(e, t, n) {
1363
- if (n && typeof n == "object")
1364
- return {
1365
- anchor: yn(e, t, n.anchor),
1366
- head: yn(e, t, n.head)
1367
- };
1368
- if (n == "start")
1369
- return {
1370
- anchor: t.from,
1371
- head: t.from
1372
- };
1373
- var r = gn(t);
1374
- if (n == "around")
1375
- return {
1376
- anchor: t.from,
1377
- head: r
1378
- };
1379
- if (n == "end")
1380
- return {
1381
- anchor: r,
1382
- head: r
1383
- };
1384
- var i = function(e) {
1385
- if (On(e, t.from))
1386
- return e;
1387
- if (!On(t.to, e))
1388
- return r;
1389
- var n = e.line + t.text.length - (t.to.line - t.from.line)-1, i = e.ch;
1390
- return e.line == t.to.line && (i += r.ch - t.to.ch), Ln(n, i)
1391
- };
1392
- return {
1393
- anchor: i(e.sel.anchor),
1394
- head: i(e.sel.head)
1395
- }
1396
- }
1397
- function wn(e, t, n) {
1398
- var r = {
1399
- canceled: !1,
1400
- from: t.from,
1401
- to: t.to,
1402
- text: t.text,
1403
- origin: t.origin,
1404
- cancel: function() {
1405
- this.canceled=!0
1406
- }
1407
- };
1408
- return n && (r.update = function(t, n, r, i) {
1409
- t && (this.from = Dn(e, t)), n && (this.to = Dn(e, n)), r && (this.text = r), i !== undefined && (this.origin = i)
1410
- }), qi(e, "beforeChange", e, r), e.cm && qi(e.cm, "beforeChange", e.cm, r), r.canceled ? null : {
1411
- from: r.from,
1412
- to: r.to,
1413
- text: r.text,
1414
- origin: r.origin
1415
- }
1416
- }
1417
- function En(e, t, n, r) {
1418
- if (e.cm) {
1419
- if (!e.cm.curOp)
1420
- return Mt(e.cm, En)(e, t, n, r);
1421
- if (e.cm.state.suppressEdits)
1422
- return
1423
- }
1424
- if (Vi(e, "beforeChange") || e.cm && Vi(e.cm, "beforeChange")) {
1425
- t = wn(e, t, !0);
1426
- if (!t)
1427
- return
1428
- }
1429
- var i = E&&!r && Lr(e, t.from, t.to);
1430
- if (i) {
1431
- for (var s = i.length-1; s >= 1; --s)
1432
- Sn(e, {
1433
- from: i[s].from,
1434
- to: i[s].to,
1435
- text: [""]
1436
- });
1437
- i.length && Sn(e, {
1438
- from: i[0].from,
1439
- to: i[0].to,
1440
- text: t.text
1441
- }, n)
1442
- } else
1443
- Sn(e, t, n)
1444
- }
1445
- function Sn(e, t, n) {
1446
- if (t.text.length == 1 && t.text[0] == "" && An(t.from, t.to))
1447
- return;
1448
- var r = bn(e, t, n);
1449
- xi(e, t, r, e.cm ? e.cm.curOp.id : NaN), Nn(e, t, r, Cr(e, t));
1450
- var i = [];
1451
- li(e, function(e, n) {
1452
- !n && ns(i, e.history)==-1 && (Ai(e.history, t), i.push(e.history)), Nn(e, t, null, Cr(e, t))
1453
- })
1454
- }
1455
- function xn(e, t) {
1456
- if (e.cm && e.cm.state.suppressEdits)
1457
- return;
1458
- var n = e.history, r = (t == "undo" ? n.done : n.undone).pop();
1459
- if (!r)
1460
- return;
1461
- var i = {
1462
- changes: [],
1463
- anchorBefore: r.anchorAfter,
1464
- headBefore: r.headAfter,
1465
- anchorAfter: r.anchorBefore,
1466
- headAfter: r.headBefore,
1467
- generation: n.generation
1468
- };
1469
- (t == "undo" ? n.undone : n.done).push(i), n.generation = r.generation||++n.maxGeneration;
1470
- var s = Vi(e, "beforeChange") || e.cm && Vi(e.cm, "beforeChange");
1471
- for (var o = r.changes.length-1; o >= 0; --o) {
1472
- var u = r.changes[o];
1473
- u.origin = t;
1474
- if (s&&!wn(e, u, !1)) {
1475
- (t == "undo" ? n.done : n.undone).length = 0;
1476
- return
1477
- }
1478
- i.changes.push(Si(e, u));
1479
- var a = o ? bn(e, u, null): {
1480
- anchor: r.anchorBefore,
1481
- head: r.headBefore
1482
- };
1483
- Nn(e, u, a, kr(e, u));
1484
- var f = [];
1485
- li(e, function(e, t) {
1486
- !t && ns(f, e.history)==-1 && (Ai(e.history, u), f.push(e.history)), Nn(e, u, null, kr(e, u))
1487
- })
1488
- }
1489
- }
1490
- function Tn(e, t) {
1491
- function n(e) {
1492
- return Ln(e.line + t, e.ch)
1493
- }
1494
- e.first += t, e.cm && Pt(e.cm, e.first, e.first, t), e.sel.head = n(e.sel.head), e.sel.anchor = n(e.sel.anchor), e.sel.from = n(e.sel.from), e.sel.to = n(e.sel.to)
1495
- }
1496
- function Nn(e, t, n, r) {
1497
- if (e.cm&&!e.cm.curOp)
1498
- return Mt(e.cm, Nn)(e, t, n, r);
1499
- if (t.to.line < e.first) {
1500
- Tn(e, t.text.length-1 - (t.to.line - t.from.line));
1501
- return
1502
- }
1503
- if (t.from.line > e.lastLine())
1504
- return;
1505
- if (t.from.line < e.first) {
1506
- var i = t.text.length-1 - (e.first - t.from.line);
1507
- Tn(e, i), t = {
1508
- from: Ln(e.first, 0),
1509
- to: Ln(t.to.line + i, t.to.ch),
1510
- text: [es(t.text)],
1511
- origin: t.origin
1512
- }
1513
- }
1514
- var s = e.lastLine();
1515
- t.to.line > s && (t = {
1516
- from: t.from,
1517
- to: Ln(s, hi(e, s).text.length),
1518
- text: [t.text[0]],
1519
- origin: t.origin
1520
- }), t.removed = pi(e, t.from, t.to), n || (n = bn(e, t, null)), e.cm ? Cn(e.cm, t, r, n) : ri(e, t, r, n)
1521
- }
1522
- function Cn(e, t, n, r) {
1523
- var i = e.doc, s = e.display, o = t.from, u = t.to, a=!1, f = o.line;
1524
- e.options.lineWrapping || (f = mi(_r(i, hi(i, o.line))), i.iter(f, u.line + 1, function(e) {
1525
- if (e == s.maxLine)
1526
- return a=!0, !0
1527
- })), !On(i.sel.head, t.from)&&!On(t.to, i.sel.head) && (e.curOp.cursorActivity=!0), ri(i, t, n, r, k(e)), e.options.lineWrapping || (i.iter(f, o.line + t.text.length, function(e) {
1528
- var t = D(i, e);
1529
- t > s.maxLineLength && (s.maxLine = e, s.maxLineLength = t, s.maxLineChanged=!0, a=!1)
1530
- }), a && (e.curOp.updateMaxLine=!0)), i.frontier = Math.min(i.frontier, o.line), tt(e, 400);
1531
- var l = t.text.length - (u.line - o.line)-1;
1532
- Pt(e, o.line, u.line + 1, l);
1533
- if (Vi(e, "change")) {
1534
- var c = {
1535
- from: o,
1536
- to: u,
1537
- text: t.text,
1538
- removed: t.removed,
1539
- origin: t.origin
1540
- };
1541
- if (e.curOp.textChanged) {
1542
- for (var h = e.curOp.textChanged; h.next; h = h.next);
1543
- h.next = c
1544
- } else
1545
- e.curOp.textChanged = c
1546
- }
1547
- }
1548
- function kn(e, t, n, r, i) {
1549
- r || (r = n);
1550
- if (On(r, n)) {
1551
- var s = r;
1552
- r = n, n = s
1553
- }
1554
- typeof t == "string" && (t = Ss(t)), En(e, {
1555
- from: n,
1556
- to: r,
1557
- text: t,
1558
- origin: i
1559
- }, null)
1560
- }
1561
- function Ln(e, t) {
1562
- if (!(this instanceof Ln))
1563
- return new Ln(e, t);
1564
- this.line = e, this.ch = t
1565
- }
1566
- function An(e, t) {
1567
- return e.line == t.line && e.ch == t.ch
1568
- }
1569
- function On(e, t) {
1570
- return e.line < t.line || e.line == t.line && e.ch < t.ch
1571
- }
1572
- function Mn(e) {
1573
- return Ln(e.line, e.ch)
1574
- }
1575
- function _n(e, t) {
1576
- return Math.max(e.first, Math.min(t, e.first + e.size-1))
1577
- }
1578
- function Dn(e, t) {
1579
- if (t.line < e.first)
1580
- return Ln(e.first, 0);
1581
- var n = e.first + e.size-1;
1582
- return t.line > n ? Ln(n, hi(e, n).text.length) : Pn(t, hi(e, t.line).text.length)
1583
- }
1584
- function Pn(e, t) {
1585
- var n = e.ch;
1586
- return n == null || n > t ? Ln(e.line, t) : n < 0 ? Ln(e.line, 0) : e
1587
- }
1588
- function Hn(e, t) {
1589
- return t >= e.first && t < e.first + e.size
1590
- }
1591
- function Bn(e, t, n, r) {
1592
- if (e.sel.shift || e.sel.extend) {
1593
- var i = e.sel.anchor;
1594
- if (n) {
1595
- var s = On(t, i);
1596
- s != On(n, i) ? (i = t, t = n) : s != On(t, n) && (t = n)
1597
- }
1598
- Fn(e, i, t, r)
1599
- } else
1600
- Fn(e, t, n || t, r);
1601
- e.cm && (e.cm.curOp.userSelChange=!0)
1602
- }
1603
- function jn(e, t, n) {
1604
- var r = {
1605
- anchor: t,
1606
- head: n
1607
- };
1608
- return qi(e, "beforeSelectionChange", e, r), e.cm && qi(e.cm, "beforeSelectionChange", e.cm, r), r.anchor = Dn(e, r.anchor), r.head = Dn(e, r.head), r
1609
- }
1610
- function Fn(e, t, n, r, i) {
1611
- if (!i && Vi(e, "beforeSelectionChange") || e.cm && Vi(e.cm, "beforeSelectionChange")) {
1612
- var s = jn(e, t, n);
1613
- n = s.head, t = s.anchor
1614
- }
1615
- var o = e.sel;
1616
- o.goalColumn = null, r == null && (r = On(n, o.head)?-1 : 1);
1617
- if (i ||!An(t, o.anchor))
1618
- t = qn(e, t, r, i != "push");
1619
- if (i ||!An(n, o.head))
1620
- n = qn(e, n, r, i != "push");
1621
- if (An(o.anchor, t) && An(o.head, n))
1622
- return;
1623
- o.anchor = t, o.head = n;
1624
- var u = On(n, t);
1625
- o.from = u ? n : t, o.to = u ? t : n, e.cm && (e.cm.curOp.updateInput = e.cm.curOp.selectionChanged = e.cm.curOp.cursorActivity=!0), zi(e, "cursorActivity", e)
1626
- }
1627
- function In(e) {
1628
- Fn(e.doc, e.doc.sel.from, e.doc.sel.to, null, "push")
1629
- }
1630
- function qn(e, t, n, r) {
1631
- var i=!1, s = t, o = n || 1;
1632
- e.cantEdit=!1;
1633
- e: for (; ;) {
1634
- var u = hi(e, s.line);
1635
- if (u.markedSpans)
1636
- for (var a = 0; a < u.markedSpans.length; ++a) {
1637
- var f = u.markedSpans[a], l = f.marker;
1638
- if ((f.from == null || (l.inclusiveLeft ? f.from <= s.ch : f.from < s.ch)) && (f.to == null || (l.inclusiveRight ? f.to >= s.ch : f.to > s.ch))) {
1639
- if (r) {
1640
- qi(l, "beforeCursorEnter");
1641
- if (l.explicitlyCleared) {
1642
- if (!u.markedSpans)
1643
- break;
1644
- --a;
1645
- continue
1646
- }
1647
- }
1648
- if (!l.atomic)
1649
- continue;
1650
- var c = l.find()[o < 0 ? "from": "to"];
1651
- if (An(c, s)) {
1652
- c.ch += o, c.ch < 0 ? c.line > e.first ? c = Dn(e, Ln(c.line-1)) : c = null : c.ch > u.text.length && (c.line < e.first + e.size-1 ? c = Ln(c.line + 1, 0) : c = null);
1653
- if (!c) {
1654
- if (i)
1655
- return r ? (e.cantEdit=!0, Ln(e.first, 0)) : qn(e, t, n, !0);
1656
- i=!0, c = t, o =- o
1657
- }
1658
- }
1659
- s = c;
1660
- continue e
1661
- }
1662
- }
1663
- return s
1664
- }
1665
- }
1666
- function Rn(e) {
1667
- var t = Un(e, e.doc.sel.head, null, e.options.cursorScrollMargin);
1668
- if (!e.state.focused)
1669
- return;
1670
- var n = e.display, r = vs(n.sizer), i = null;
1671
- t.top + r.top < 0 ? i=!0 : t.bottom + r.top > (window.innerHeight || document.documentElement.clientHeight) && (i=!1);
1672
- if (i != null&&!p) {
1673
- var s = n.cursor.style.display == "none";
1674
- s && (n.cursor.style.display = "", n.cursor.style.left = t.left + "px", n.cursor.style.top = t.top - n.viewOffset + "px"), n.cursor.scrollIntoView(i), s && (n.cursor.style.display = "none")
1675
- }
1676
- }
1677
- function Un(e, t, n, r) {
1678
- r == null && (r = 0);
1679
- for (; ;) {
1680
- var i=!1, s = Et(e, t), o=!n || n == t ? s : Et(e, n), u = Wn(e, Math.min(s.left, o.left), Math.min(s.top, o.top) - r, Math.max(s.left, o.left), Math.max(s.bottom, o.bottom) + r), a = e.doc.scrollTop, f = e.doc.scrollLeft;
1681
- u.scrollTop != null && (Zt(e, u.scrollTop), Math.abs(e.doc.scrollTop - a) > 1 && (i=!0)), u.scrollLeft != null && (en(e, u.scrollLeft), Math.abs(e.doc.scrollLeft - f) > 1 && (i=!0));
1682
- if (!i)
1683
- return s
1684
- }
1685
- }
1686
- function zn(e, t, n, r, i) {
1687
- var s = Wn(e, t, n, r, i);
1688
- s.scrollTop != null && Zt(e, s.scrollTop), s.scrollLeft != null && en(e, s.scrollLeft)
1689
- }
1690
- function Wn(e, t, n, r, i) {
1691
- var s = e.display, o = Ct(e.display);
1692
- n < 0 && (n = 0);
1693
- var u = s.scroller.clientHeight - Ji, a = s.scroller.scrollTop, f = {}, l = e.doc.height + ot(s), c = n < o, h = i > l - o;
1694
- if (n < a)
1695
- f.scrollTop = c ? 0 : n;
1696
- else if (i > a + u) {
1697
- var p = Math.min(n, (h ? l : i) - u);
1698
- p != a && (f.scrollTop = p)
1699
- }
1700
- var d = s.scroller.clientWidth - Ji, v = s.scroller.scrollLeft;
1701
- t += s.gutters.offsetWidth, r += s.gutters.offsetWidth;
1702
- var m = s.gutters.offsetWidth, g = t < m + 10;
1703
- return t < v + m || g ? (g && (t = 0), f.scrollLeft = Math.max(0, t-10 - m)) : r > d + v-3 && (f.scrollLeft = r + 10 - d), f
1704
- }
1705
- function Xn(e, t, n) {
1706
- e.curOp.updateScrollPos = {
1707
- scrollLeft: t == null ? e.doc.scrollLeft: t,
1708
- scrollTop: n == null ? e.doc.scrollTop: n
1709
- }
1710
- }
1711
- function Vn(e, t, n) {
1712
- var r = e.curOp.updateScrollPos || (e.curOp.updateScrollPos = {
1713
- scrollLeft: e.doc.scrollLeft,
1714
- scrollTop: e.doc.scrollTop
1715
- }), i = e.display.scroller;
1716
- r.scrollTop = Math.max(0, Math.min(i.scrollHeight - i.clientHeight, r.scrollTop + n)), r.scrollLeft = Math.max(0, Math.min(i.scrollWidth - i.clientWidth, r.scrollLeft + t))
1717
- }
1718
- function $n(e, t, n, r) {
1719
- var i = e.doc;
1720
- n == null && (n = "add");
1721
- if (n == "smart")
1722
- if (!e.doc.mode.indent)
1723
- n = "prev";
1724
- else
1725
- var s = it(e, t);
1726
- var o = e.options.tabSize, u = hi(i, t), a = Gi(u.text, null, o), f = u.text.match(/^\s*/)[0], l;
1727
- if (n == "smart") {
1728
- l = e.doc.mode.indent(s, u.text.slice(f.length), u.text);
1729
- if (l == Ki) {
1730
- if (!r)
1731
- return;
1732
- n = "prev"
1733
- }
1734
- }
1735
- n == "prev" ? t > i.first ? l = Gi(hi(i, t-1).text, null, o) : l = 0 : n == "add" ? l = a + e.options.indentUnit : n == "subtract" ? l = a - e.options.indentUnit : typeof n == "number" && (l = a + n), l = Math.max(0, l);
1736
- var c = "", h = 0;
1737
- if (e.options.indentWithTabs)
1738
- for (var p = Math.floor(l / o); p; --p)
1739
- h += o, c += " ";
1740
- h < l && (c += Zi(l - h)), c != f ? kn(e.doc, c, Ln(t, 0), Ln(t, f.length), "+input") : i.sel.head.line == t && i.sel.head.ch < f.length && Fn(i, Ln(t, f.length), Ln(t, f.length), 1), u.stateAfter = null
1741
- }
1742
- function Jn(e, t, n) {
1743
- var r = t, i = t, s = e.doc;
1744
- return typeof t == "number" ? i = hi(s, _n(s, t)) : r = mi(t), r == null ? null : n(i, r) ? (Pt(e, r, r + 1), i) : null
1745
- }
1746
- function Kn(e, t, n, r, i) {
1747
- function l() {
1748
- var t = s + n;
1749
- return t < e.first || t >= e.first + e.size ? f=!1 : (s = t, a = hi(e, t))
1750
- }
1751
- function c(e) {
1752
- var t = (i ? js : Fs)(a, o, n, !0);
1753
- if (t == null) {
1754
- if (!!e ||!l())
1755
- return f=!1;
1756
- i ? o = (n < 0 ? Os : As)(a) : o = n < 0 ? a.text.length : 0
1757
- } else
1758
- o = t;
1759
- return !0
1760
- }
1761
- var s = t.line, o = t.ch, u = n, a = hi(e, s), f=!0;
1762
- if (r == "char")
1763
- c();
1764
- else if (r == "column")
1765
- c(!0);
1766
- else if (r == "word" || r == "group") {
1767
- var h = null, p = r == "group";
1768
- for (var d=!0; ; d=!1) {
1769
- if (n < 0&&!c(!d))
1770
- break;
1771
- var v = a.text.charAt(o) || "\n", m = as(v) ? "w": p ? /\s/.test(v) ? null: "p": null;
1772
- if (h && h != m) {
1773
- n < 0 && (n = 1, c());
1774
- break
1775
- }
1776
- m && (h = m);
1777
- if (n > 0&&!c(!d))
1778
- break
1779
- }
1780
- }
1781
- var g = qn(e, Ln(s, o), u, !0);
1782
- return f || (g.hitSide=!0), g
1783
- }
1784
- function Qn(e, t, n, r) {
1785
- var i = e.doc, s = t.left, o;
1786
- if (r == "page") {
1787
- var u = Math.min(e.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
1788
- o = t.top + n * (u - (n < 0 ? 1.5 : .5) * Ct(e.display))
1789
- } else
1790
- r == "line" && (o = n > 0 ? t.bottom + 3 : t.top-3);
1791
- for (; ;) {
1792
- var a = xt(e, s, o);
1793
- if (!a.outside)
1794
- break;
1795
- if (n < 0 ? o <= 0 : o >= i.height) {
1796
- a.hitSide=!0;
1797
- break
1798
- }
1799
- o += n * 5
1800
- }
1801
- return a
1802
- }
1803
- function Gn(e, t) {
1804
- var n = t.ch, r = t.ch;
1805
- if (e) {
1806
- (t.xRel < 0 || r == e.length) && n?--n:
1807
- ++r;
1808
- var i = e.charAt(n), s = as(i) ? as: /\s/.test(i) ? function(e) {
1809
- return /\s/.test(e)
1810
- }
1811
- : function(e) {
1812
- return !/\s/.test(e)&&!as(e)
1813
- };
1814
- while (n > 0 && s(e.charAt(n-1)))--n;
1815
- while (r < e.length && s(e.charAt(r)))++r
1816
- }
1817
- return {
1818
- from: Ln(t.line, n),
1819
- to: Ln(t.line, r)
1820
- }
1821
- }
1822
- function Yn(e, t) {
1823
- Bn(e.doc, Ln(t, 0), Dn(e.doc, Ln(t + 1, 0)))
1824
- }
1825
- function tr(e, t, n, r) {
1826
- x.defaults[e] = t, n && (Zn[e] = r ? function(e, t, r) {
1827
- r != nr && n(e, t, r)
1828
- } : n)
1829
- }
1830
- function ar(e, t) {
1831
- if (t===!0)
1832
- return t;
1833
- if (e.copyState)
1834
- return e.copyState(t);
1835
- var n = {};
1836
- for (var r in t) {
1837
- var i = t[r];
1838
- i instanceof Array && (i = i.concat([])), n[r] = i
1839
- }
1840
- return n
1841
- }
1842
- function fr(e, t, n) {
1843
- return e.startState ? e.startState(t, n) : !0
1844
- }
1845
- function hr(e) {
1846
- return typeof e == "string" ? cr[e] : e
1847
- }
1848
- function pr(e, t, n) {
1849
- function r(t) {
1850
- t = hr(t);
1851
- var i = t[e];
1852
- if (i===!1)
1853
- return "stop";
1854
- if (i != null && n(i))
1855
- return !0;
1856
- if (t.nofallthrough)
1857
- return "stop";
1858
- var s = t.fallthrough;
1859
- if (s == null)
1860
- return !1;
1861
- if (Object.prototype.toString.call(s) != "[object Array]")
1862
- return r(s);
1863
- for (var o = 0, u = s.length; o < u; ++o) {
1864
- var a = r(s[o]);
1865
- if (a)
1866
- return a
1867
- }
1868
- return !1
1869
- }
1870
- for (var i = 0; i < t.length; ++i) {
1871
- var s = r(t[i]);
1872
- if (s)
1873
- return s != "stop"
1874
- }
1875
- }
1876
- function dr(e) {
1877
- var t = Ns[e.keyCode];
1878
- return t == "Ctrl" || t == "Alt" || t == "Shift" || t == "Mod"
1879
- }
1880
- function vr(e, t) {
1881
- if (a && e.keyCode == 34 && e["char"])
1882
- return !1;
1883
- var n = Ns[e.keyCode];
1884
- if (n == null || e.altGraphKey)
1885
- return !1;
1886
- e.altKey && (n = "Alt-" + n);
1887
- if (b ? e.metaKey : e.ctrlKey)
1888
- n = "Ctrl-" + n;
1889
- if (b ? e.ctrlKey : e.metaKey)
1890
- n = "Cmd-" + n;
1891
- return !t && e.shiftKey && (n = "Shift-" + n), n
1892
- }
1893
- function mr(e, t) {
1894
- this.pos = this.start = 0, this.string = e, this.tabSize = t || 8, this.lastColumnPos = this.lastColumnValue = 0
1895
- }
1896
- function gr(e, t) {
1897
- this.lines = [], this.type = t, this.doc = e
1898
- }
1899
- function yr(e, t, n, r, i) {
1900
- if (r && r.shared)
1901
- return wr(e, t, n, r, i);
1902
- if (e.cm&&!e.cm.curOp)
1903
- return Mt(e.cm, yr)(e, t, n, r, i);
1904
- var s = new gr(e, i);
1905
- if (On(n, t) || An(t, n) && i == "range" && (!r.inclusiveLeft ||!r.inclusiveRight))
1906
- return s;
1907
- r && is(r, s), s.replacedWith && (s.collapsed=!0, s.replacedWith = cs("span", [s.replacedWith], "CodeMirror-widget"), r.handleMouseEvents || (s.replacedWith.ignoreEvents=!0)), s.collapsed && (S=!0), s.addToHistory && xi(e, {
1908
- from: t,
1909
- to: n,
1910
- origin: "markText"
1911
- }, {
1912
- head: e.sel.head,
1913
- anchor: e.sel.anchor
1914
- }, NaN);
1915
- var o = t.line, u = 0, a, f, l = e.cm, c;
1916
- e.iter(o, n.line + 1, function(r) {
1917
- l && s.collapsed&&!l.options.lineWrapping && _r(e, r) == l.display.maxLine && (c=!0);
1918
- var i = {
1919
- from: null,
1920
- to: null,
1921
- marker: s
1922
- };
1923
- u += r.text.length, o == t.line && (i.from = t.ch, u -= t.ch), o == n.line && (i.to = n.ch, u -= r.text.length - n.ch), s.collapsed && (o == n.line && (f = Ar(r, n.ch)), o == t.line ? a = Ar(r, t.ch) : vi(r, 0)), xr(r, i), ++o
1924
- }), s.collapsed && e.iter(t.line, n.line + 1, function(t) {
1925
- Dr(e, t) && vi(t, 0)
1926
- }), s.clearOnEnter && Fi(s, "beforeCursorEnter", function() {
1927
- s.clear()
1928
- }), s.readOnly && (E=!0, (e.history.done.length || e.history.undone.length) && e.clearHistory());
1929
- if (s.collapsed) {
1930
- if (a != f)
1931
- throw new Error("Inserting collapsed marker overlapping an existing one");
1932
- s.size = u, s.atomic=!0
1933
- }
1934
- return l && (c && (l.curOp.updateMaxLine=!0), (s.className || s.title || s.startStyle || s.endStyle || s.collapsed) && Pt(l, t.line, n.line + 1), s.atomic && In(l)), s
1935
- }
1936
- function br(e, t) {
1937
- this.markers = e, this.primary = t;
1938
- for (var n = 0, r = this; n < e.length; ++n)
1939
- e[n].parent = this, Fi(e[n], "clear", function() {
1940
- r.clear()
1941
- })
1942
- }
1943
- function wr(e, t, n, r, i) {
1944
- r = is(r), r.shared=!1;
1945
- var s = [yr(e, t, n, r, i)], o = s[0], u = r.replacedWith;
1946
- return li(e, function(e) {
1947
- u && (r.replacedWith = u.cloneNode(!0)), s.push(yr(e, Dn(e, t), Dn(e, n), r, i));
1948
- for (var a = 0; a < e.linked.length; ++a)
1949
- if (e.linked[a].isParent)
1950
- return;
1951
- o = es(s)
1952
- }), new br(s, o)
1953
- }
1954
- function Er(e, t) {
1955
- if (e)
1956
- for (var n = 0; n < e.length; ++n) {
1957
- var r = e[n];
1958
- if (r.marker == t)
1959
- return r
1960
- }
1961
- }
1962
- function Sr(e, t) {
1963
- for (var n, r = 0; r < e.length; ++r)
1964
- e[r] != t && (n || (n = [])).push(e[r]);
1965
- return n
1966
- }
1967
- function xr(e, t) {
1968
- e.markedSpans = e.markedSpans ? e.markedSpans.concat([t]) : [t], t.marker.attachLine(e)
1969
- }
1970
- function Tr(e, t, n) {
1971
- if (e)
1972
- for (var r = 0, i; r < e.length; ++r) {
1973
- var s = e[r], o = s.marker, u = s.from == null || (o.inclusiveLeft ? s.from <= t : s.from < t);
1974
- if (u || (o.inclusiveLeft && o.inclusiveRight || o.type == "bookmark") && s.from == t && (!n ||!s.marker.insertLeft)) {
1975
- var a = s.to == null || (o.inclusiveRight ? s.to >= t : s.to > t);
1976
- (i || (i = [])).push({
1977
- from: s.from,
1978
- to: a ? null: s.to,
1979
- marker: o
1980
- })
1981
- }
1982
- }
1983
- return i
1984
- }
1985
- function Nr(e, t, n) {
1986
- if (e)
1987
- for (var r = 0, i; r < e.length; ++r) {
1988
- var s = e[r], o = s.marker, u = s.to == null || (o.inclusiveRight ? s.to >= t : s.to > t);
1989
- if (u || o.type == "bookmark" && s.from == t && (!n || s.marker.insertLeft)) {
1990
- var a = s.from == null || (o.inclusiveLeft ? s.from <= t : s.from < t);
1991
- (i || (i = [])).push({
1992
- from: a ? null: s.from - t,
1993
- to: s.to == null ? null: s.to - t,
1994
- marker: o
1995
- })
1996
- }
1997
- }
1998
- return i
1999
- }
2000
- function Cr(e, t) {
2001
- var n = Hn(e, t.from.line) && hi(e, t.from.line).markedSpans, r = Hn(e, t.to.line) && hi(e, t.to.line).markedSpans;
2002
- if (!n&&!r)
2003
- return null;
2004
- var i = t.from.ch, s = t.to.ch, o = An(t.from, t.to), u = Tr(n, i, o), a = Nr(r, s, o), f = t.text.length == 1, l = es(t.text).length + (f ? i : 0);
2005
- if (u)
2006
- for (var c = 0; c < u.length; ++c) {
2007
- var h = u[c];
2008
- if (h.to == null) {
2009
- var p = Er(a, h.marker);
2010
- p ? f && (h.to = p.to == null ? null : p.to + l) : h.to = i
2011
- }
2012
- }
2013
- if (a)
2014
- for (var c = 0; c < a.length; ++c) {
2015
- var h = a[c];
2016
- h.to != null && (h.to += l);
2017
- if (h.from == null) {
2018
- var p = Er(u, h.marker);
2019
- p || (h.from = l, f && (u || (u = [])).push(h))
2020
- } else
2021
- h.from += l, f && (u || (u = [])).push(h)
2022
- }
2023
- if (f && u) {
2024
- for (var c = 0; c < u.length; ++c)
2025
- u[c].from != null && u[c].from == u[c].to && u[c].marker.type != "bookmark" && u.splice(c--, 1);
2026
- u.length || (u = null)
2027
- }
2028
- var d = [u];
2029
- if (!f) {
2030
- var v = t.text.length-2, m;
2031
- if (v > 0 && u)
2032
- for (var c = 0; c < u.length; ++c)
2033
- u[c].to == null && (m || (m = [])).push({
2034
- from: null,
2035
- to: null,
2036
- marker: u[c].marker
2037
- });
2038
- for (var c = 0; c < v; ++c)
2039
- d.push(m);
2040
- d.push(a)
2041
- }
2042
- return d
2043
- }
2044
- function kr(e, t) {
2045
- var n = Ni(e, t), r = Cr(e, t);
2046
- if (!n)
2047
- return r;
2048
- if (!r)
2049
- return n;
2050
- for (var i = 0; i < n.length; ++i) {
2051
- var s = n[i], o = r[i];
2052
- if (s && o)
2053
- e: for (var u = 0; u < o.length; ++u) {
2054
- var a = o[u];
2055
- for (var f = 0; f < s.length; ++f)
2056
- if (s[f].marker == a.marker)
2057
- continue e;
2058
- s.push(a)
2059
- } else
2060
- o && (n[i] = o)
2061
- }
2062
- return n
2063
- }
2064
- function Lr(e, t, n) {
2065
- var r = null;
2066
- e.iter(t.line, n.line + 1, function(e) {
2067
- if (e.markedSpans)
2068
- for (var t = 0; t < e.markedSpans.length; ++t) {
2069
- var n = e.markedSpans[t].marker;
2070
- n.readOnly && (!r || ns(r, n)==-1) && (r || (r = [])).push(n)
2071
- }
2072
- });
2073
- if (!r)
2074
- return null;
2075
- var i = [{
2076
- from: t,
2077
- to: n
2078
- }
2079
- ];
2080
- for (var s = 0; s < r.length; ++s) {
2081
- var o = r[s], u = o.find();
2082
- for (var a = 0; a < i.length; ++a) {
2083
- var f = i[a];
2084
- if (On(f.to, u.from) || On(u.to, f.from))
2085
- continue;
2086
- var l = [a, 1];
2087
- (On(f.from, u.from) ||!o.inclusiveLeft && An(f.from, u.from)) && l.push({
2088
- from: f.from,
2089
- to: u.from
2090
- }), (On(u.to, f.to) ||!o.inclusiveRight && An(f.to, u.to)) && l.push({
2091
- from: u.to,
2092
- to: f.to
2093
- }), i.splice.apply(i, l), a += l.length-1
2094
- }
2095
- }
2096
- return i
2097
- }
2098
- function Ar(e, t) {
2099
- var n = S && e.markedSpans, r;
2100
- if (n)
2101
- for (var i, s = 0; s < n.length; ++s) {
2102
- i = n[s];
2103
- if (!i.marker.collapsed)
2104
- continue;
2105
- (i.from == null || i.from < t) && (i.to == null || i.to > t) && (!r || r.width < i.marker.width) && (r = i.marker)
2106
- }
2107
- return r
2108
- }
2109
- function Or(e) {
2110
- return Ar(e, -1)
2111
- }
2112
- function Mr(e) {
2113
- return Ar(e, e.text.length + 1)
2114
- }
2115
- function _r(e, t) {
2116
- var n;
2117
- while (n = Or(t))
2118
- t = hi(e, n.find().from.line);
2119
- return t
2120
- }
2121
- function Dr(e, t) {
2122
- var n = S && t.markedSpans;
2123
- if (n)
2124
- for (var r, i = 0; i < n.length; ++i) {
2125
- r = n[i];
2126
- if (!r.marker.collapsed)
2127
- continue;
2128
- if (r.from == null)
2129
- return !0;
2130
- if (r.marker.replacedWith)
2131
- continue;
2132
- if (r.from == 0 && r.marker.inclusiveLeft && Pr(e, t, r))
2133
- return !0
2134
- }
2135
- }
2136
- function Pr(e, t, n) {
2137
- if (n.to == null) {
2138
- var r = n.marker.find().to, i = hi(e, r.line);
2139
- return Pr(e, i, Er(i.markedSpans, n.marker))
2140
- }
2141
- if (n.marker.inclusiveRight && n.to == t.text.length)
2142
- return !0;
2143
- for (var s, o = 0; o < t.markedSpans.length; ++o) {
2144
- s = t.markedSpans[o];
2145
- if (s.marker.collapsed&&!s.marker.replacedWith && s.from == n.to && (s.marker.inclusiveLeft || n.marker.inclusiveRight) && Pr(e, t, s))
2146
- return !0
2147
- }
2148
- }
2149
- function Hr(e) {
2150
- var t = e.markedSpans;
2151
- if (!t)
2152
- return;
2153
- for (var n = 0; n < t.length; ++n)
2154
- t[n].marker.detachLine(e);
2155
- e.markedSpans = null
2156
- }
2157
- function Br(e, t) {
2158
- if (!t)
2159
- return;
2160
- for (var n = 0; n < t.length; ++n)
2161
- t[n].marker.attachLine(e);
2162
- e.markedSpans = t
2163
- }
2164
- function Fr(e) {
2165
- return function() {
2166
- var t=!this.cm.curOp;
2167
- t && At(this.cm);
2168
- try {
2169
- var n = e.apply(this, arguments)
2170
- } finally {
2171
- t && Ot(this.cm)
2172
- }
2173
- return n
2174
- }
2175
- }
2176
- function Ir(e) {
2177
- return e.height != null ? e.height : ((!e.node.parentNode || e.node.parentNode.nodeType != 1) && ps(e.cm.display.measure, cs("div", [e.node], null, "position: relative")), e.height = e.node.offsetHeight)
2178
- }
2179
- function qr(e, t, n, r) {
2180
- var i = new jr(e, n, r);
2181
- return i.noHScroll && (e.display.alignWidgets=!0), Jn(e, t, function(t) {
2182
- var n = t.widgets || (t.widgets = []);
2183
- i.insertAt == null ? n.push(i) : n.splice(Math.min(n.length-1, Math.max(0, i.insertAt)), 0, i), i.line = t;
2184
- if (!Dr(e.doc, t) || i.showIfHidden) {
2185
- var r = yi(e, t) < e.doc.scrollTop;
2186
- vi(t, t.height + Ir(i)), r && Vn(e, 0, i.height)
2187
- }
2188
- return !0
2189
- }), i
2190
- }
2191
- function Ur(e, t, n, r) {
2192
- e.text = t, e.stateAfter && (e.stateAfter = null), e.styles && (e.styles = null), e.order != null && (e.order = null), Hr(e), Br(e, n);
2193
- var i = r ? r(e): 1;
2194
- i != e.height && vi(e, i)
2195
- }
2196
- function zr(e) {
2197
- e.parent = null, Hr(e)
2198
- }
2199
- function Wr(e, t, n, r, i, s) {
2200
- var o = n.flattenSpans;
2201
- o == null && (o = e.options.flattenSpans);
2202
- var u = 0, a = null, f = new mr(t, e.options.tabSize), l;
2203
- t == "" && n.blankLine && n.blankLine(r);
2204
- while (!f.eol()) {
2205
- f.pos > e.options.maxHighlightLength ? (o=!1, s && $r(e, t, r, f.pos), f.pos = t.length, l = null) : l = n.token(f, r);
2206
- if (!o || a != l)
2207
- u < f.start && i(f.start, a), u = f.start, a = l;
2208
- f.start = f.pos
2209
- }
2210
- while (u < f.pos) {
2211
- var c = Math.min(f.pos, u + 5e4);
2212
- i(c, a), u = c
2213
- }
2214
- }
2215
- function Xr(e, t, n, r) {
2216
- var i = [e.state.modeGen];
2217
- Wr(e, t.text, e.doc.mode, n, function(e, t) {
2218
- i.push(e, t)
2219
- }, r);
2220
- for (var s = 0; s < e.state.overlays.length; ++s) {
2221
- var o = e.state.overlays[s], u = 1, a = 0;
2222
- Wr(e, t.text, o.mode, !0, function(e, t) {
2223
- var n = u;
2224
- while (a < e) {
2225
- var r = i[u];
2226
- r > e && i.splice(u, 1, e, i[u + 1], r), u += 2, a = Math.min(e, r)
2227
- }
2228
- if (!t)
2229
- return;
2230
- if (o.opaque)
2231
- i.splice(n, u - n, e, t), u = n + 2;
2232
- else
2233
- for (; n < u; n += 2) {
2234
- var s = i[n + 1];
2235
- i[n + 1] = s ? s + " " + t : t
2236
- }
2237
- })
2238
- }
2239
- return i
2240
- }
2241
- function Vr(e, t) {
2242
- if (!t.styles || t.styles[0] != e.state.modeGen)
2243
- t.styles = Xr(e, t, t.stateAfter = it(e, mi(t)));
2244
- return t.styles
2245
- }
2246
- function $r(e, t, n, r) {
2247
- var i = e.doc.mode, s = new mr(t, e.options.tabSize);
2248
- s.start = s.pos = r || 0, t == "" && i.blankLine && i.blankLine(n);
2249
- while (!s.eol() && s.pos <= e.options.maxHighlightLength)
2250
- i.token(s, n), s.start = s.pos
2251
- }
2252
- function Kr(e, t) {
2253
- if (!e)
2254
- return null;
2255
- for (; ;) {
2256
- var n = e.match(/(?:^|\s)line-(background-)?(\S+)/);
2257
- if (!n)
2258
- break;
2259
- e = e.slice(0, n.index) + e.slice(n.index + n[0].length);
2260
- var r = n[1] ? "bgClass": "textClass";
2261
- t[r] == null ? t[r] = n[2] : (new RegExp("(?:^|s)" + n[2] + "(?:$|s)")).test(t[r]) || (t[r] += " " + n[2])
2262
- }
2263
- return Jr[e] || (Jr[e] = "cm-" + e.replace(/ +/g, " cm-"))
2264
- }
2265
- function Qr(e, n, r, o) {
2266
- var u, a = n, f=!0;
2267
- while (u = Or(a))
2268
- a = hi(e.doc, u.find().from.line);
2269
- var l = {
2270
- pre: cs("pre"),
2271
- col: 0,
2272
- pos: 0,
2273
- measure: null,
2274
- measuredSomething: !1,
2275
- cm: e,
2276
- copyWidgets: o
2277
- };
2278
- do {
2279
- a.text && (f=!1), l.measure = a == n && r, l.pos = 0, l.addToken = l.measure ? Zr : Yr, (t || s) && e.getOption("lineWrapping") && (l.addToken = ei(l.addToken));
2280
- var c = ni(a, l, Vr(e, a));
2281
- r && a == n&&!l.measuredSomething && (r[0] = l.pre.appendChild(Es(e.display.measure)), l.measuredSomething=!0), c && (a = hi(e.doc, c.to.line))
2282
- }
2283
- while (c);
2284
- r&&!l.measuredSomething&&!r[0] && (r[0] = l.pre.appendChild(f ? cs("span", " ") : Es(e.display.measure))), !l.pre.firstChild&&!Dr(e.doc, n) && l.pre.appendChild(document.createTextNode(" "));
2285
- var h;
2286
- if (r && (t || i) && (h = bi(a))) {
2287
- var p = h.length-1;
2288
- h[p].from == h[p].to&&--p;
2289
- var d = h[p], v = h[p-1];
2290
- if (d.from + 1 == d.to && v && d.level < v.level) {
2291
- var m = r[l.pos-1];
2292
- m && m.parentNode.insertBefore(m.measureRight = Es(e.display.measure), m.nextSibling)
2293
- }
2294
- }
2295
- var g = l.textClass ? l.textClass + " " + (n.textClass || ""): n.textClass;
2296
- return g && (l.pre.className = g), qi(e, "renderLine", e, n, l.pre), l
2297
- }
2298
- function Gr(e) {
2299
- var t = cs("span", "•", "cm-invalidchar");
2300
- return t.title = "\\u" + e.charCodeAt(0).toString(16), t
2301
- }
2302
- function Yr(e, t, n, r, i, s) {
2303
- if (!t)
2304
- return;
2305
- var o = e.cm.options.specialChars;
2306
- if (!o.test(t)) {
2307
- e.col += t.length;
2308
- var u = document.createTextNode(t)
2309
- } else {
2310
- var u = document.createDocumentFragment(), a = 0;
2311
- for (; ;) {
2312
- o.lastIndex = a;
2313
- var f = o.exec(t), l = f ? f.index - a: t.length - a;
2314
- l && (u.appendChild(document.createTextNode(t.slice(a, a + l))), e.col += l);
2315
- if (!f)
2316
- break;
2317
- a += l + 1;
2318
- if (f[0] == " ") {
2319
- var c = e.cm.options.tabSize, h = c - e.col%c;
2320
- u.appendChild(cs("span", Zi(h), "cm-tab")), e.col += h
2321
- } else {
2322
- var p = e.cm.options.specialCharPlaceholder(f[0]);
2323
- u.appendChild(p), e.col += 1
2324
- }
2325
- }
2326
- }
2327
- if (n || r || i || e.measure) {
2328
- var d = n || "";
2329
- r && (d += r), i && (d += i);
2330
- var p = cs("span", [u], d);
2331
- return s && (p.title = s), e.pre.appendChild(p)
2332
- }
2333
- e.pre.appendChild(u)
2334
- }
2335
- function Zr(e, n, r, i, s) {
2336
- var o = e.cm.options.lineWrapping;
2337
- for (var u = 0; u < n.length; ++u) {
2338
- var a = n.charAt(u), f = u == 0;
2339
- a >= "���" && a < "���" && u < n.length-1 ? (a = n.slice(u, u + 2), ++u) : u && o && gs(n, u) && e.pre.appendChild(cs("wbr"));
2340
- var l = e.measure[e.pos], c = e.measure[e.pos] = Yr(e, a, r, f && i, u == n.length-1 && s);
2341
- l && (c.leftSide = l.leftSide || l), t && o && a == " " && u&&!/\s/.test(n.charAt(u-1)) && u < n.length-1&&!/\s/.test(n.charAt(u + 1)) && (c.style.whiteSpace = "normal"), e.pos += a.length
2342
- }
2343
- n.length && (e.measuredSomething=!0)
2344
- }
2345
- function ei(e) {
2346
- function t(e) {
2347
- var t = " ";
2348
- for (var n = 0; n < e.length-2; ++n)
2349
- t += n%2 ? " " : " ";
2350
- return t += " ", t
2351
- }
2352
- return function(n, r, i, s, o, u) {
2353
- return e(n, r.replace(/ {3,}/g, t), i, s, o, u)
2354
- }
2355
- }
2356
- function ti(e, t, n, r) {
2357
- var i=!r && n.replacedWith;
2358
- if (i) {
2359
- e.copyWidgets && (i = i.cloneNode(!0)), e.pre.appendChild(i);
2360
- if (e.measure) {
2361
- if (t)
2362
- e.measure[e.pos] = i;
2363
- else {
2364
- var s = Es(e.cm.display.measure);
2365
- if (n.type == "bookmark"&&!n.insertLeft)
2366
- e.measure[e.pos] = e.pre.appendChild(s);
2367
- else {
2368
- if (e.measure[e.pos])
2369
- return;
2370
- e.measure[e.pos] = e.pre.insertBefore(s, i)
2371
- }
2372
- }
2373
- e.measuredSomething=!0
2374
- }
2375
- }
2376
- e.pos += t
2377
- }
2378
- function ni(e, t, n) {
2379
- var r = e.markedSpans, i = e.text, s = 0;
2380
- if (!r) {
2381
- for (var o = 1; o < n.length; o += 2)
2382
- t.addToken(t, i.slice(s, s = n[o]), Kr(n[o + 1], t));
2383
- return
2384
- }
2385
- var u = i.length, a = 0, o = 1, f = "", l, c = 0, h, p, d, v, m;
2386
- for (; ;) {
2387
- if (c == a) {
2388
- h = p = d = v = "", m = null, c = Infinity;
2389
- var g = [];
2390
- for (var y = 0; y < r.length; ++y) {
2391
- var b = r[y], w = b.marker;
2392
- b.from <= a && (b.to == null || b.to > a) ? (b.to != null && c > b.to && (c = b.to, p = ""), w.className && (h += " " + w.className), w.startStyle && b.from == a && (d += " " + w.startStyle), w.endStyle && b.to == c && (p += " " + w.endStyle), w.title&&!v && (v = w.title), w.collapsed && (!m || m.marker.size < w.size) && (m = b)) : b.from > a && c > b.from && (c = b.from), w.type == "bookmark" && b.from == a && w.replacedWith && g.push(w)
2393
- }
2394
- if (m && (m.from || 0) == a) {
2395
- ti(t, (m.to == null ? u : m.to) - a, m.marker, m.from == null);
2396
- if (m.to == null)
2397
- return m.marker.find()
2398
- }
2399
- if (!m && g.length)
2400
- for (var y = 0; y < g.length; ++y)
2401
- ti(t, 0, g[y])
2402
- }
2403
- if (a >= u)
2404
- break;
2405
- var E = Math.min(u, c);
2406
- for (; ;) {
2407
- if (f) {
2408
- var S = a + f.length;
2409
- if (!m) {
2410
- var x = S > E ? f.slice(0, E - a): f;
2411
- t.addToken(t, x, l ? l + h : h, d, a + x.length == c ? p : "", v)
2412
- }
2413
- if (S >= E) {
2414
- f = f.slice(E - a), a = E;
2415
- break
2416
- }
2417
- a = S, d = ""
2418
- }
2419
- f = i.slice(s, s = n[o++]), l = Kr(n[o++], t)
2420
- }
2421
- }
2422
- }
2423
- function ri(e, t, n, r, i) {
2424
- function s(e) {
2425
- return n ? n[e] : null
2426
- }
2427
- function o(e, n, r) {
2428
- Ur(e, n, r, i), zi(e, "change", e, t)
2429
- }
2430
- var u = t.from, a = t.to, f = t.text, l = hi(e, u.line), c = hi(e, a.line), h = es(f), p = s(f.length-1), d = a.line - u.line;
2431
- if (u.ch == 0 && a.ch == 0 && h == "" && (!e.cm || e.cm.options.wholeLineUpdateBefore)) {
2432
- for (var v = 0, m = f.length-1, g = []; v < m; ++v)
2433
- g.push(new Rr(f[v], s(v), i));
2434
- o(c, c.text, p), d && e.remove(u.line, d), g.length && e.insert(u.line, g)
2435
- } else if (l == c
2436
- )
2437
- if (f.length == 1)
2438
- o(l, l.text.slice(0, u.ch) + h + l.text.slice(a.ch), p);
2439
- else {
2440
- for (var g = [], v = 1, m = f.length-1; v < m; ++v)
2441
- g.push(new Rr(f[v], s(v), i));
2442
- g.push(new Rr(h + l.text.slice(a.ch), p, i)), o(l, l.text.slice(0, u.ch) + f[0], s(0)), e.insert(u.line + 1, g)
2443
- } else if (f.length == 1)
2444
- o(l, l.text.slice(0, u.ch) + f[0] + c.text.slice(a.ch), s(0)), e.remove(u.line + 1, d);
2445
- else {
2446
- o(l, l.text.slice(0, u.ch) + f[0], s(0)), o(c, h + c.text.slice(a.ch), p);
2447
- for (var v = 1, m = f.length-1, g = []; v < m; ++v)
2448
- g.push(new Rr(f[v], s(v), i));
2449
- d > 1 && e.remove(u.line + 1, d-1), e.insert(u.line + 1, g)
2450
- }
2451
- zi(e, "change", e, t), Fn(e, r.anchor, r.head, null, !0)
2452
- }
2453
- function ii(e) {
2454
- this.lines = e, this.parent = null;
2455
- for (var t = 0, n = e.length, r = 0; t < n; ++t)
2456
- e[t].parent = this, r += e[t].height;
2457
- this.height = r
2458
- }
2459
- function si(e) {
2460
- this.children = e;
2461
- var t = 0, n = 0;
2462
- for (var r = 0, i = e.length; r < i; ++r) {
2463
- var s = e[r];
2464
- t += s.chunkSize(), n += s.height, s.parent = this
2465
- }
2466
- this.size = t, this.height = n, this.parent = null
2467
- }
2468
- function li(e, t, n) {
2469
- function r(e, i, s) {
2470
- if (e.linked)
2471
- for (var o = 0; o < e.linked.length; ++o) {
2472
- var u = e.linked[o];
2473
- if (u.doc == i)
2474
- continue;
2475
- var a = s && u.sharedHist;
2476
- if (n&&!a)
2477
- continue;
2478
- t(u.doc, a), r(u.doc, e, a)
2479
- }
2480
- }
2481
- r(e, null, !0)
2482
- }
2483
- function ci(e, t) {
2484
- if (t.cm)
2485
- throw new Error("This document is already in use.");
2486
- e.doc = t, t.cm = e, L(e), N(e), e.options.lineWrapping || P(e), e.options.mode = t.modeOption, Pt(e)
2487
- }
2488
- function hi(e, t) {
2489
- t -= e.first;
2490
- while (!e.lines)
2491
- for (var n = 0; ; ++n) {
2492
- var r = e.children[n], i = r.chunkSize();
2493
- if (t < i) {
2494
- e = r;
2495
- break
2496
- }
2497
- t -= i
2498
- }
2499
- return e.lines[t]
2500
- }
2501
- function pi(e, t, n) {
2502
- var r = [], i = t.line;
2503
- return e.iter(t.line, n.line + 1, function(e) {
2504
- var s = e.text;
2505
- i == n.line && (s = s.slice(0, n.ch)), i == t.line && (s = s.slice(t.ch)), r.push(s), ++i
2506
- }), r
2507
- }
2508
- function di(e, t, n) {
2509
- var r = [];
2510
- return e.iter(t, n, function(e) {
2511
- r.push(e.text)
2512
- }), r
2513
- }
2514
- function vi(e, t) {
2515
- var n = t - e.height;
2516
- for (var r = e; r; r = r.parent)
2517
- r.height += n
2518
- }
2519
- function mi(e) {
2520
- if (e.parent == null)
2521
- return null;
2522
- var t = e.parent, n = ns(t.lines, e);
2523
- for (var r = t.parent; r; t = r, r = r.parent)
2524
- for (var i = 0; ; ++i) {
2525
- if (r.children[i] == t)
2526
- break;
2527
- n += r.children[i].chunkSize()
2528
- }
2529
- return n + t.first
2530
- }
2531
- function gi(e, t) {
2532
- var n = e.first;
2533
- e: do {
2534
- for (var r = 0, i = e.children.length; r < i; ++r) {
2535
- var s = e.children[r], o = s.height;
2536
- if (t < o) {
2537
- e = s;
2538
- continue e
2539
- }
2540
- t -= o, n += s.chunkSize()
2541
- }
2542
- return n
2543
- }
2544
- while (!e.lines);
2545
- for (var r = 0, i = e.lines.length; r < i; ++r) {
2546
- var u = e.lines[r], a = u.height;
2547
- if (t < a)
2548
- break;
2549
- t -= a
2550
- }
2551
- return n + r
2552
- }
2553
- function yi(e, t) {
2554
- t = _r(e.doc, t);
2555
- var n = 0, r = t.parent;
2556
- for (var i = 0; i < r.lines.length; ++i) {
2557
- var s = r.lines[i];
2558
- if (s == t)
2559
- break;
2560
- n += s.height
2561
- }
2562
- for (var o = r.parent; o; r = o, o = r.parent)
2563
- for (var i = 0; i < o.children.length; ++i) {
2564
- var u = o.children[i];
2565
- if (u == r)
2566
- break;
2567
- n += u.height
2568
- }
2569
- return n
2570
- }
2571
- function bi(e) {
2572
- var t = e.order;
2573
- return t == null && (t = e.order = Is(e.text)), t
2574
- }
2575
- function wi(e) {
2576
- return {
2577
- done: [],
2578
- undone: [],
2579
- undoDepth: Infinity,
2580
- lastTime: 0,
2581
- lastOp: null,
2582
- lastOrigin: null,
2583
- generation: e || 1,
2584
- maxGeneration: e || 1
2585
- }
2586
- }
2587
- function Ei(e, t, n, r) {
2588
- var i = t["spans_" + e.id], s = 0;
2589
- e.iter(Math.max(e.first, n), Math.min(e.first + e.size, r), function(n) {
2590
- n.markedSpans && ((i || (i = t["spans_" + e.id] = {}))[s] = n.markedSpans), ++s
2591
- })
2592
- }
2593
- function Si(e, t) {
2594
- var n = {
2595
- line: t.from.line,
2596
- ch: t.from.ch
2597
- }, r = {
2598
- from: n,
2599
- to: gn(t),
2600
- text: pi(e, t.from, t.to)
2601
- };
2602
- return Ei(e, r, t.from.line, t.to.line + 1), li(e, function(e) {
2603
- Ei(e, r, t.from.line, t.to.line + 1)
2604
- }, !0), r
2605
- }
2606
- function xi(e, t, n, r) {
2607
- var i = e.history;
2608
- i.undone.length = 0;
2609
- var s =+ (new Date), o = es(i.done);
2610
- if (o && (i.lastOp == r || i.lastOrigin == t.origin && t.origin && (t.origin.charAt(0) == "+" && e.cm && i.lastTime > s - e.cm.options.historyEventDelay || t.origin.charAt(0) == "*"))) {
2611
- var u = es(o.changes);
2612
- An(t.from, t.to) && An(t.from, u.to) ? u.to = gn(t) : o.changes.push(Si(e, t)), o.anchorAfter = n.anchor, o.headAfter = n.head
2613
- } else {
2614
- o = {
2615
- changes: [Si(e, t)],
2616
- generation: i.generation,
2617
- anchorBefore: e.sel.anchor,
2618
- headBefore: e.sel.head,
2619
- anchorAfter: n.anchor,
2620
- headAfter: n.head
2621
- }, i.done.push(o), i.generation=++i.maxGeneration;
2622
- while (i.done.length > i.undoDepth)
2623
- i.done.shift()
2624
- }
2625
- i.lastTime = s, i.lastOp = r, i.lastOrigin = t.origin
2626
- }
2627
- function Ti(e) {
2628
- if (!e)
2629
- return null;
2630
- for (var t = 0, n; t < e.length; ++t)
2631
- e[t].marker.explicitlyCleared ? n || (n = e.slice(0, t)) : n && n.push(e[t]);
2632
- return n ? n.length ? n : null : e
2633
- }
2634
- function Ni(e, t) {
2635
- var n = t["spans_" + e.id];
2636
- if (!n)
2637
- return null;
2638
- for (var r = 0, i = []; r < t.text.length; ++r)
2639
- i.push(Ti(n[r]));
2640
- return i
2641
- }
2642
- function Ci(e, t) {
2643
- for (var n = 0, r = []; n < e.length; ++n) {
2644
- var i = e[n], s = i.changes, o = [];
2645
- r.push({
2646
- changes: o,
2647
- anchorBefore: i.anchorBefore,
2648
- headBefore: i.headBefore,
2649
- anchorAfter: i.anchorAfter,
2650
- headAfter: i.headAfter
2651
- });
2652
- for (var u = 0; u < s.length; ++u) {
2653
- var a = s[u], f;
2654
- o.push({
2655
- from: a.from,
2656
- to: a.to,
2657
- text: a.text
2658
- });
2659
- if (t)
2660
- for (var l in a)(f = l.match(/^spans_(\d+)$/)
2661
- ) && ns(t, Number(f[1]))>-1 && (es(o)[l] = a[l], delete a[l])
2662
- }
2663
- }
2664
- return r
2665
- }
2666
- function ki(e, t, n, r) {
2667
- n < e.line ? e.line += r : t < e.line && (e.line = t, e.ch = 0)
2668
- }
2669
- function Li(e, t, n, r) {
2670
- for (var i = 0; i < e.length; ++i) {
2671
- var s = e[i], o=!0;
2672
- for (var u = 0; u < s.changes.length; ++u) {
2673
- var a = s.changes[u];
2674
- s.copied || (a.from = Mn(a.from), a.to = Mn(a.to));
2675
- if (n < a.from.line)
2676
- a.from.line += r, a.to.line += r;
2677
- else if (t <= a.to.line) {
2678
- o=!1;
2679
- break
2680
- }
2681
- }
2682
- s.copied || (s.anchorBefore = Mn(s.anchorBefore), s.headBefore = Mn(s.headBefore), s.anchorAfter = Mn(s.anchorAfter), s.readAfter = Mn(s.headAfter), s.copied=!0), o ? (ki(s.anchorBefore), ki(s.headBefore), ki(s.anchorAfter), ki(s.headAfter)) : (e.splice(0, i + 1), i = 0)
2683
- }
2684
- }
2685
- function Ai(e, t) {
2686
- var n = t.from.line, r = t.to.line, i = t.text.length - (r - n)-1;
2687
- Li(e.done, n, r, i), Li(e.undone, n, r, i)
2688
- }
2689
- function Oi() {
2690
- Hi(this)
2691
- }
2692
- function Mi(e) {
2693
- return e.stop || (e.stop = Oi), e
2694
- }
2695
- function _i(e) {
2696
- e.preventDefault ? e.preventDefault() : e.returnValue=!1
2697
- }
2698
- function Di(e) {
2699
- e.stopPropagation ? e.stopPropagation() : e.cancelBubble=!0
2700
- }
2701
- function Pi(e) {
2702
- return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == 0
2703
- }
2704
- function Hi(e) {
2705
- _i(e), Di(e)
2706
- }
2707
- function Bi(e) {
2708
- return e.target || e.srcElement
2709
- }
2710
- function ji(e) {
2711
- var t = e.which;
2712
- return t == null && (e.button & 1 ? t = 1 : e.button & 2 ? t = 3 : e.button & 4 && (t = 2)), m && e.ctrlKey && t == 1 && (t = 3), t
2713
- }
2714
- function Fi(e, t, n) {
2715
- if (e.addEventListener)
2716
- e.addEventListener(t, n, !1);
2717
- else if (e.attachEvent)
2718
- e.attachEvent("on" + t, n);
2719
- else {
2720
- var r = e._handlers || (e._handlers = {}), i = r[t] || (r[t] = []);
2721
- i.push(n)
2722
- }
2723
- }
2724
- function Ii(e, t, n) {
2725
- if (e.removeEventListener)
2726
- e.removeEventListener(t, n, !1);
2727
- else if (e.detachEvent)
2728
- e.detachEvent("on" + t, n);
2729
- else {
2730
- var r = e._handlers && e._handlers[t];
2731
- if (!r)
2732
- return;
2733
- for (var i = 0; i < r.length; ++i)
2734
- if (r[i] == n) {
2735
- r.splice(i, 1);
2736
- break
2737
- }
2738
- }
2739
- }
2740
- function qi(e, t) {
2741
- var n = e._handlers && e._handlers[t];
2742
- if (!n)
2743
- return;
2744
- var r = Array.prototype.slice.call(arguments, 2);
2745
- for (var i = 0; i < n.length; ++i)
2746
- n[i].apply(null, r)
2747
- }
2748
- function zi(e, t) {
2749
- function i(e) {
2750
- return function() {
2751
- e.apply(null, r)
2752
- }
2753
- }
2754
- var n = e._handlers && e._handlers[t];
2755
- if (!n)
2756
- return;
2757
- var r = Array.prototype.slice.call(arguments, 2);
2758
- Ri || (++Ui, Ri = [], setTimeout(Xi, 0));
2759
- for (var s = 0; s < n.length; ++s)
2760
- Ri.push(i(n[s]))
2761
- }
2762
- function Wi(e, t, n) {
2763
- return qi(e, n || t.type, e, t), Pi(t) || t.codemirrorIgnore
2764
- }
2765
- function Xi() {
2766
- --Ui;
2767
- var e = Ri;
2768
- Ri = null;
2769
- for (var t = 0; t < e.length; ++t)
2770
- e[t]()
2771
- }
2772
- function Vi(e, t) {
2773
- var n = e._handlers && e._handlers[t];
2774
- return n && n.length > 0
2775
- }
2776
- function $i(e) {
2777
- e.prototype.on = function(e, t) {
2778
- Fi(this, e, t)
2779
- }, e.prototype.off = function(e, t) {
2780
- Ii(this, e, t)
2781
- }
2782
- }
2783
- function Qi() {
2784
- this.id = null
2785
- }
2786
- function Gi(e, t, n, r, i) {
2787
- t == null && (t = e.search(/[^\s\u00a0]/), t==-1 && (t = e.length));
2788
- for (var s = r || 0, o = i || 0; s < t; ++s)
2789
- e.charAt(s) == " " ? o += n - o%n : ++o;
2790
- return o
2791
- }
2792
- function Zi(e) {
2793
- while (Yi.length <= e)
2794
- Yi.push(es(Yi) + " ");
2795
- return Yi[e]
2796
- }
2797
- function es(e) {
2798
- return e[e.length-1]
2799
- }
2800
- function ts(e) {
2801
- if (d)
2802
- e.selectionStart = 0, e.selectionEnd = e.value.length;
2803
- else
2804
- try {
2805
- e.select()
2806
- } catch (t) {}
2807
- }
2808
- function ns(e, t) {
2809
- if (e.indexOf)
2810
- return e.indexOf(t);
2811
- for (var n = 0, r = e.length; n < r; ++n)
2812
- if (e[n] == t)
2813
- return n;
2814
- return -1
2815
- }
2816
- function rs(e, t) {
2817
- function n() {}
2818
- n.prototype = e;
2819
- var r = new n;
2820
- return t && is(t, r), r
2821
- }
2822
- function is(e, t) {
2823
- t || (t = {});
2824
- for (var n in e)
2825
- e.hasOwnProperty(n) && (t[n] = e[n]);
2826
- return t
2827
- }
2828
- function ss(e) {
2829
- for (var t = [], n = 0; n < e; ++n)
2830
- t.push(undefined);
2831
- return t
2832
- }
2833
- function os(e) {
2834
- var t = Array.prototype.slice.call(arguments, 1);
2835
- return function() {
2836
- return e.apply(null, t)
2837
- }
2838
- }
2839
- function as(e) {
2840
- return /\w/.test(e) || e > "€" && (e.toUpperCase() != e.toLowerCase() || us.test(e))
2841
- }
2842
- function fs(e) {
2843
- for (var t in e)
2844
- if (e.hasOwnProperty(t) && e[t])
2845
- return !1;
2846
- return !0
2847
- }
2848
- function cs(e, t, n, r) {
2849
- var i = document.createElement(e);
2850
- n && (i.className = n), r && (i.style.cssText = r);
2851
- if (typeof t == "string")
2852
- ds(i, t);
2853
- else if (t)
2854
- for (var s = 0; s < t.length; ++s)
2855
- i.appendChild(t[s]);
2856
- return i
2857
- }
2858
- function hs(e) {
2859
- for (var t = e.childNodes.length; t > 0; --t)
2860
- e.removeChild(e.firstChild);
2861
- return e
2862
- }
2863
- function ps(e, t) {
2864
- return hs(e).appendChild(t)
2865
- }
2866
- function ds(e, t) {
2867
- r ? (e.innerHTML = "", e.appendChild(document.createTextNode(t))) : e.textContent = t
2868
- }
2869
- function vs(e) {
2870
- return e.getBoundingClientRect()
2871
- }
2872
- function gs() {
2873
- return !1
2874
- }
2875
- function bs(e) {
2876
- if (ys != null)
2877
- return ys;
2878
- var t = cs("div", null, null, "width: 50px; height: 50px; overflow-x: scroll");
2879
- return ps(e, t), t.offsetWidth && (ys = t.offsetHeight - t.clientHeight), ys || 0
2880
- }
2881
- function Es(e) {
2882
- if (ws == null) {
2883
- var t = cs("span", "​");
2884
- ps(e, cs("span", [t, document.createTextNode("x")])), e.firstChild.offsetHeight != 0 && (ws = t.offsetWidth <= 1 && t.offsetHeight > 2&&!n)
2885
- }
2886
- return ws ? cs("span", "​") : cs("span", " ", null, "display: inline-block; width: 1px; margin-right: -1px")
2887
- }
2888
- function Cs(e, t, n, r) {
2889
- if (!e)
2890
- return r(t, n, "ltr");
2891
- var i=!1;
2892
- for (var s = 0; s < e.length; ++s) {
2893
- var o = e[s];
2894
- if (o.from < n && o.to > t || t == n && o.to == t)
2895
- r(Math.max(o.from, t), Math.min(o.to, n), o.level == 1 ? "rtl" : "ltr"), i=!0
2896
- }
2897
- i || r(t, n, "ltr")
2898
- }
2899
- function ks(e) {
2900
- return e.level%2 ? e.to : e.from
2901
- }
2902
- function Ls(e) {
2903
- return e.level%2 ? e.from : e.to
2904
- }
2905
- function As(e) {
2906
- var t = bi(e);
2907
- return t ? ks(t[0]) : 0
2908
- }
2909
- function Os(e) {
2910
- var t = bi(e);
2911
- return t ? Ls(es(t)) : e.text.length
2912
- }
2913
- function Ms(e, t) {
2914
- var n = hi(e.doc, t), r = _r(e.doc, n);
2915
- r != n && (t = mi(r));
2916
- var i = bi(r), s = i ? i[0].level%2 ? Os(r): As(r): 0;
2917
- return Ln(t, s)
2918
- }
2919
- function _s(e, t) {
2920
- var n, r;
2921
- while (n = Mr(r = hi(e.doc, t)))
2922
- t = n.find().to.line;
2923
- var i = bi(r), s = i ? i[0].level%2 ? As(r): Os(r): r.text.length;
2924
- return Ln(t, s)
2925
- }
2926
- function Ds(e, t, n) {
2927
- var r = e[0].level;
2928
- return t == r?!0 : n == r?!1 : t < n
2929
- }
2930
- function Hs(e, t) {
2931
- for (var n = 0, r; n < e.length; ++n) {
2932
- var i = e[n];
2933
- if (i.from < t && i.to > t)
2934
- return Ps = null, n;
2935
- if (i.from == t || i.to == t) {
2936
- if (r != null)
2937
- return Ds(e, i.level, e[r].level) ? (Ps = r, n) : (Ps = n, r);
2938
- r = n
2939
- }
2940
- }
2941
- return Ps = null, r
2942
- }
2943
- function Bs(e, t, n, r) {
2944
- if (!r)
2945
- return t + n;
2946
- do
2947
- t += n;
2948
- while (t > 0 && ls.test(e.text.charAt(t)));
2949
- return t
2950
- }
2951
- function js(e, t, n, r) {
2952
- var i = bi(e);
2953
- if (!i)
2954
- return Fs(e, t, n, r);
2955
- var s = Hs(i, t), o = i[s], u = Bs(e, t, o.level%2?-n : n, r);
2956
- for (; ;) {
2957
- if (u > o.from && u < o.to)
2958
- return u;
2959
- if (u == o.from || u == o.to)
2960
- return Hs(i, u) == s ? u : (o = i[s += n], n > 0 == o.level%2 ? o.to : o.from);
2961
- o = i[s += n];
2962
- if (!o)
2963
- return null;
2964
- n > 0 == o.level%2 ? u = Bs(e, o.to, -1, r) : u = Bs(e, o.from, 1, r)
2965
- }
2966
- }
2967
- function Fs(e, t, n, r) {
2968
- var i = t + n;
2969
- if (r)
2970
- while (i > 0 && ls.test(e.text.charAt(i)))
2971
- i += n;
2972
- return i < 0 || i > e.text.length ? null : i
2973
- }
2974
- var e = /gecko\/\d/i.test(navigator.userAgent), t = /MSIE \d/.test(navigator.userAgent), n = t && (document.documentMode == null || document.documentMode < 8), r = t && (document.documentMode == null || document.documentMode < 9), i = /Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent), s = /WebKit\//.test(navigator.userAgent), o = s && /Qt\/\d+\.\d+/.test(navigator.userAgent), u = /Chrome\//.test(navigator.userAgent), a = /Opera\//.test(navigator.userAgent), f = /Apple Computer/.test(navigator.vendor), l = /KHTML\//.test(navigator.userAgent), c = /Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent), h = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent), p = /PhantomJS/.test(navigator.userAgent), d = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent), v = d || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent), m = d || /Mac/.test(navigator.platform), g = /win/i.test(navigator.platform), y = a && navigator.userAgent.match(/Version\/(\d*\.\d*)/);
2975
- y && (y = Number(y[1])), y && y >= 15 && (a=!1, s=!0);
2976
- var b = m && (o || a && (y == null || y < 12.11)), w = e || t&&!r, E=!1, S=!1, Nt, Lt = 0, Wt, Xt, Qt = 0, tn = 0, nn = null;
2977
- t ? nn =- 0.53 : e ? nn = 15 : u ? nn =- 0.7 : f && (nn =- 1 / 3);
2978
- var un, ln = null, vn, gn = x.changeEnd = function(e) {
2979
- return e.text ? Ln(e.from.line + e.text.length-1, es(e.text).length + (e.text.length == 1 ? e.from.ch : 0)) : e.to
2980
- };
2981
- x.Pos = Ln, x.prototype = {
2982
- constructor: x,
2983
- focus: function() {
2984
- window.focus(), It(this), Bt(this)
2985
- },
2986
- setOption: function(e, t) {
2987
- var n = this.options, r = n[e];
2988
- if (n[e] == t && e != "mode")
2989
- return;
2990
- n[e] = t, Zn.hasOwnProperty(e) && Mt(this, Zn[e])(this, t, r)
2991
- },
2992
- getOption: function(e) {
2993
- return this.options[e]
2994
- },
2995
- getDoc: function() {
2996
- return this.doc
2997
- },
2998
- addKeyMap: function(e, t) {
2999
- this.state.keyMaps[t ? "push": "unshift"](e)
3000
- },
3001
- removeKeyMap: function(e) {
3002
- var t = this.state.keyMaps;
3003
- for (var n = 0; n < t.length; ++n)
3004
- if (t[n] == e || typeof t[n] != "string" && t[n].name == e)
3005
- return t.splice(n, 1), !0
3006
- },
3007
- addOverlay: Mt(null, function(e, t) {
3008
- var n = e.token ? e: x.getMode(this.options, e);
3009
- if (n.startState)
3010
- throw new Error("Overlays may not be stateful.");
3011
- this.state.overlays.push({
3012
- mode: n,
3013
- modeSpec: e,
3014
- opaque: t && t.opaque
3015
- }), this.state.modeGen++, Pt(this)
3016
- }),
3017
- removeOverlay: Mt(null, function(e) {
3018
- var t = this.state.overlays;
3019
- for (var n = 0; n < t.length; ++n) {
3020
- var r = t[n].modeSpec;
3021
- if (r == e || typeof e == "string" && r.name == e) {
3022
- t.splice(n, 1), this.state.modeGen++, Pt(this);
3023
- return
3024
- }
3025
- }
3026
- }),
3027
- indentLine: Mt(null, function(e, t, n) {
3028
- typeof t != "string" && typeof t != "number" && (t == null ? t = this.options.smartIndent ? "smart" : "prev" : t = t ? "add" : "subtract"), Hn(this.doc, e) && $n(this, e, t, n)
3029
- }),
3030
- indentSelection: Mt(null, function(e) {
3031
- var t = this.doc.sel;
3032
- if (An(t.from, t.to))
3033
- return $n(this, t.from.line, e);
3034
- var n = t.to.line - (t.to.ch ? 0 : 1);
3035
- for (var r = t.from.line; r <= n; ++r)
3036
- $n(this, r, e)
3037
- }),
3038
- getTokenAt: function(e, t) {
3039
- var n = this.doc;
3040
- e = Dn(n, e);
3041
- var r = it(this, e.line, t), i = this.doc.mode, s = hi(n, e.line), o = new mr(s.text, this.options.tabSize);
3042
- while (o.pos < e.ch&&!o.eol()) {
3043
- o.start = o.pos;
3044
- var u = i.token(o, r)
3045
- }
3046
- return {
3047
- start: o.start,
3048
- end: o.pos,
3049
- string: o.current(),
3050
- className: u || null,
3051
- type: u || null,
3052
- state: r
3053
- }
3054
- },
3055
- getTokenTypeAt: function(e) {
3056
- e = Dn(this.doc, e);
3057
- var t = Vr(this, hi(this.doc, e.line)), n = 0, r = (t.length-1) / 2, i = e.ch;
3058
- if (i == 0)
3059
- return t[2];
3060
- for (; ;) {
3061
- var s = n + r>>1;
3062
- if ((s ? t[s * 2-1] : 0) >= i)
3063
- r = s;
3064
- else {
3065
- if (!(t[s * 2 + 1] < i))
3066
- return t[s * 2 + 2];
3067
- n = s + 1
3068
- }
3069
- }
3070
- },
3071
- getModeAt: function(e) {
3072
- var t = this.doc.mode;
3073
- return t.innerMode ? x.innerMode(t, this.getTokenAt(e).state).mode : t
3074
- },
3075
- getHelper: function(e, t) {
3076
- if (!ur.hasOwnProperty(t))
3077
- return;
3078
- var n = ur[t], r = this.getModeAt(e);
3079
- return r[t] && n[r[t]] || r.helperType && n[r.helperType] || n[r.name]
3080
- },
3081
- getStateAfter: function(e, t) {
3082
- var n = this.doc;
3083
- return e = _n(n, e == null ? n.first + n.size-1 : e), it(this, e + 1, t)
3084
- },
3085
- cursorCoords: function(e, t) {
3086
- var n, r = this.doc.sel;
3087
- return e == null ? n = r.head : typeof e == "object" ? n = Dn(this.doc, e) : n = e ? r.from : r.to, Et(this, n, t || "page")
3088
- },
3089
- charCoords: function(e, t) {
3090
- return wt(this, Dn(this.doc, e), t || "page")
3091
- },
3092
- coordsChar: function(e, t) {
3093
- return e = bt(this, e, t || "page"), xt(this, e.left, e.top)
3094
- },
3095
- lineAtHeight: function(e, t) {
3096
- return e = bt(this, {
3097
- top: e,
3098
- left: 0
3099
- }, t || "page").top, gi(this.doc, e + this.display.viewOffset)
3100
- },
3101
- heightAtLine: function(e, t) {
3102
- var n=!1, r = this.doc.first + this.doc.size-1;
3103
- e < this.doc.first ? e = this.doc.first : e > r && (e = r, n=!0);
3104
- var i = hi(this.doc, e);
3105
- return yt(this, hi(this.doc, e), {
3106
- top: 0,
3107
- left: 0
3108
- }, t || "page").top + (n ? i.height : 0)
3109
- },
3110
- defaultTextHeight: function() {
3111
- return Ct(this.display)
3112
- },
3113
- defaultCharWidth: function() {
3114
- return kt(this.display)
3115
- },
3116
- setGutterMarker: Mt(null, function(e, t, n) {
3117
- return Jn(this, e, function(e) {
3118
- var r = e.gutterMarkers || (e.gutterMarkers = {});
3119
- return r[t] = n, !n && fs(r) && (e.gutterMarkers = null), !0
3120
- })
3121
- }),
3122
- clearGutter: Mt(null, function(e) {
3123
- var t = this, n = t.doc, r = n.first;
3124
- n.iter(function(n) {
3125
- n.gutterMarkers && n.gutterMarkers[e] && (n.gutterMarkers[e] = null, Pt(t, r, r + 1), fs(n.gutterMarkers) && (n.gutterMarkers = null)), ++r
3126
- })
3127
- }),
3128
- addLineClass: Mt(null, function(e, t, n) {
3129
- return Jn(this, e, function(e) {
3130
- var r = t == "text" ? "textClass": t == "background" ? "bgClass": "wrapClass";
3131
- if (!e[r])
3132
- e[r] = n;
3133
- else {
3134
- if ((new RegExp("(?:^|\\s)" + n + "(?:$|\\s)")).test(e[r]))
3135
- return !1;
3136
- e[r] += " " + n
3137
- }
3138
- return !0
3139
- })
3140
- }),
3141
- removeLineClass: Mt(null, function(e, t, n) {
3142
- return Jn(this, e, function(e) {
3143
- var r = t == "text" ? "textClass": t == "background" ? "bgClass": "wrapClass", i = e[r];
3144
- if (!i)
3145
- return !1;
3146
- if (n == null)
3147
- e[r] = null;
3148
- else {
3149
- var s = i.match(new RegExp("(?:^|\\s+)" + n + "(?:$|\\s+)"));
3150
- if (!s)
3151
- return !1;
3152
- var o = s.index + s[0].length;
3153
- e[r] = i.slice(0, s.index) + (!s.index || o == i.length ? "" : " ") + i.slice(o) || null
3154
- }
3155
- return !0
3156
- })
3157
- }),
3158
- addLineWidget: Mt(null, function(e, t, n) {
3159
- return qr(this, e, t, n)
3160
- }),
3161
- removeLineWidget: function(e) {
3162
- e.clear()
3163
- },
3164
- lineInfo: function(e) {
3165
- if (typeof e == "number") {
3166
- if (!Hn(this.doc, e))
3167
- return null;
3168
- var t = e;
3169
- e = hi(this.doc, e);
3170
- if (!e)
3171
- return null
3172
- } else {
3173
- var t = mi(e);
3174
- if (t == null)
3175
- return null
3176
- }
3177
- return {
3178
- line: t,
3179
- handle: e,
3180
- text: e.text,
3181
- gutterMarkers: e.gutterMarkers,
3182
- textClass: e.textClass,
3183
- bgClass: e.bgClass,
3184
- wrapClass: e.wrapClass,
3185
- widgets: e.widgets
3186
- }
3187
- },
3188
- getViewport: function() {
3189
- return {
3190
- from: this.display.showingFrom,
3191
- to: this.display.showingTo
3192
- }
3193
- },
3194
- addWidget: function(e, t, n, r, i) {
3195
- var s = this.display;
3196
- e = Et(this, Dn(this.doc, e));
3197
- var o = e.bottom, u = e.left;
3198
- t.style.position = "absolute", s.sizer.appendChild(t);
3199
- if (r == "over")
3200
- o = e.top;
3201
- else if (r == "above" || r == "near") {
3202
- var a = Math.max(s.wrapper.clientHeight, this.doc.height), f = Math.max(s.sizer.clientWidth, s.lineSpace.clientWidth);
3203
- (r == "above" || e.bottom + t.offsetHeight > a) && e.top > t.offsetHeight ? o = e.top - t.offsetHeight : e.bottom + t.offsetHeight <= a && (o = e.bottom), u + t.offsetWidth > f && (u = f - t.offsetWidth)
3204
- }
3205
- t.style.top = o + "px", t.style.left = t.style.right = "", i == "right" ? (u = s.sizer.clientWidth - t.offsetWidth, t.style.right = "0px") : (i == "left" ? u = 0 : i == "middle" && (u = (s.sizer.clientWidth - t.offsetWidth) / 2), t.style.left = u + "px"), n && zn(this, u, o, u + t.offsetWidth, o + t.offsetHeight)
3206
- },
3207
- triggerOnKeyDown: Mt(null, cn),
3208
- execCommand: function(e) {
3209
- return lr[e](this)
3210
- },
3211
- findPosH: function(e, t, n, r) {
3212
- var i = 1;
3213
- t < 0 && (i =- 1, t =- t);
3214
- for (var s = 0, o = Dn(this.doc, e); s < t; ++s) {
3215
- o = Kn(this.doc, o, i, n, r);
3216
- if (o.hitSide)
3217
- break
3218
- }
3219
- return o
3220
- },
3221
- moveH: Mt(null, function(e, t) {
3222
- var n = this.doc.sel, r;
3223
- n.shift || n.extend || An(n.from, n.to) ? r = Kn(this.doc, n.head, e, t, this.options.rtlMoveVisually) : r = e < 0 ? n.from : n.to, Bn(this.doc, r, r, e)
3224
- }),
3225
- deleteH: Mt(null, function(e, t) {
3226
- var n = this.doc.sel;
3227
- An(n.from, n.to) ? kn(this.doc, "", n.from, Kn(this.doc, n.head, e, t, !1), "+delete") : kn(this.doc, "", n.from, n.to, "+delete"), this.curOp.userSelChange=!0
3228
- }),
3229
- findPosV: function(e, t, n, r) {
3230
- var i = 1, s = r;
3231
- t < 0 && (i =- 1, t =- t);
3232
- for (var o = 0, u = Dn(this.doc, e); o < t; ++o) {
3233
- var a = Et(this, u, "div");
3234
- s == null ? s = a.left : a.left = s, u = Qn(this, a, i, n);
3235
- if (u.hitSide)
3236
- break
3237
- }
3238
- return u
3239
- },
3240
- moveV: Mt(null, function(e, t) {
3241
- var n = this.doc.sel, r = Et(this, n.head, "div");
3242
- n.goalColumn != null && (r.left = n.goalColumn);
3243
- var i = Qn(this, r, e, t);
3244
- t == "page" && Vn(this, 0, wt(this, i, "div").top - r.top), Bn(this.doc, i, i, e), n.goalColumn = r.left
3245
- }),
3246
- toggleOverwrite: function(e) {
3247
- if (e != null && e == this.state.overwrite)
3248
- return;
3249
- (this.state.overwrite=!this.state.overwrite) ? this.display.cursor.className += " CodeMirror-overwrite" : this.display.cursor.className = this.display.cursor.className.replace(" CodeMirror-overwrite", "")
3250
- },
3251
- hasFocus: function() {
3252
- return this.state.focused
3253
- },
3254
- scrollTo: Mt(null, function(e, t) {
3255
- Xn(this, e, t)
3256
- }),
3257
- getScrollInfo: function() {
3258
- var e = this.display.scroller, t = Ji;
3259
- return {
3260
- left: e.scrollLeft,
3261
- top: e.scrollTop,
3262
- height: e.scrollHeight - t,
3263
- width: e.scrollWidth - t,
3264
- clientHeight: e.clientHeight - t,
3265
- clientWidth: e.clientWidth - t
3266
- }
3267
- },
3268
- scrollIntoView: Mt(null, function(e, t) {
3269
- e == null ? e = {
3270
- from: this.doc.sel.head,
3271
- to: null
3272
- } : typeof e == "number" ? e = {
3273
- from: Ln(e, 0),
3274
- to: null
3275
- } : e.from == null && (e = {
3276
- from: e,
3277
- to: null
3278
- }), e.to || (e.to = e.from), t || (t = 0);
3279
- var n = e;
3280
- e.from.line != null && (this.curOp.scrollToPos = {
3281
- from: e.from,
3282
- to: e.to,
3283
- margin: t
3284
- }, n = {
3285
- from : Et(this, e.from), to: Et(this, e.to)
3286
- });
3287
- var r = Wn(this,
3288
- Math.min(n.from.left,
3289
- n.to.left),
3290
- Math.min(n.from.top,
3291
- n.to.top) - t,
3292
- Math.max(n.from.right,
3293
- n.to.right),
3294
- Math.max(n.from.bottom,
3295
- n.to.bottom) + t);
3296
- Xn(this,
3297
- r.scrollLeft,
3298
- r.scrollTop)
3299
- }), setSize: Mt(null, function(e, t) {
3300
- function n(e) {
3301
- return typeof e == "number" || /^\d+$/.test(String(e)) ? e + "px" : e
3302
- }
3303
- e != null && (this.display.wrapper.style.width = n(e)), t != null && (this.display.wrapper.style.height = n(t)), this.options.lineWrapping && (this.display.measureLineCache.length = this.display.measureLineCachePos = 0), this.curOp.forceUpdate=!0
3304
- }), operation: function(e) {
3305
- return Dt(this, e)
3306
- }, refresh: Mt(null, function() {
3307
- var e = this.display.cachedTextHeight == null;
3308
- vt(this), Xn(this, this.doc.scrollLeft, this.doc.scrollTop), Pt(this), e && L(this)
3309
- }), swapDoc: Mt(null, function(e) {
3310
- var t = this.doc;
3311
- return t.cm = null, ci(this, e), vt(this), Ft(this, !0), Xn(this, e.scrollLeft, e.scrollTop), zi(this, "swapDoc", this, t), t
3312
- }), getInputField: function() {
3313
- return this.display.input
3314
- }, getWrapperElement: function() {
3315
- return this.display.wrapper
3316
- }, getScrollerElement: function() {
3317
- return this.display.scroller
3318
- }, getGutterElement: function() {
3319
- return this.display.gutters
3320
- }
3321
- }, $i(x);
3322
- var Zn = x.optionHandlers = {}, er = x.defaults = {}, nr = x.Init = {
3323
- toString: function() {
3324
- return "CodeMirror.Init"
3325
- }
3326
- };
3327
- tr("value", "", function(e, t) {
3328
- e.setValue(t)
3329
- }, !0), tr("mode", null, function(e, t) {
3330
- e.doc.modeOption = t, N(e)
3331
- }, !0), tr("indentUnit", 2, N, !0), tr("indentWithTabs", !1), tr("smartIndent", !0), tr("tabSize", 4, function(e) {
3332
- N(e), vt(e), Pt(e)
3333
- }, !0), tr("specialChars", /[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g, function(e, t) {
3334
- e.options.specialChars = new RegExp(t.source + (t.test(" ") ? "" : "| "), "g"), e.refresh()
3335
- }, !0), tr("specialCharPlaceholder", Gr, function(e) {
3336
- e.refresh()
3337
- }, !0), tr("electricChars", !0), tr("rtlMoveVisually", !g), tr("wholeLineUpdateBefore", !0), tr("theme", "default", function(e) {
3338
- O(e), M(e)
3339
- }, !0), tr("keyMap", "default", A), tr("extraKeys", null), tr("onKeyEvent", null), tr("onDragEvent", null), tr("lineWrapping", !1, C, !0), tr("gutters", [], function(e) {
3340
- H(e.options), M(e)
3341
- }, !0), tr("fixedGutter", !0, function(e, t) {
3342
- e.display.gutters.style.left = t ? R(e.display) + "px" : "0", e.refresh()
3343
- }, !0), tr("coverGutterNextToScrollbar", !1, B, !0), tr("lineNumbers", !1, function(e) {
3344
- H(e.options), M(e)
3345
- }, !0), tr("firstLineNumber", 1, M, !0), tr("lineNumberFormatter", function(e) {
3346
- return e
3347
- }, M, !0), tr("showCursorWhenSelecting", !1, G, !0), tr("resetSelectionOnContextMenu", !0), tr("readOnly", !1, function(e, t) {
3348
- t == "nocursor" ? (dn(e), e.display.input.blur(), e.display.disabled=!0) : (e.display.disabled=!1, t || Ft(e, !0))
3349
- }), tr("dragDrop", !0), tr("cursorBlinkRate", 530), tr("cursorScrollMargin", 0), tr("cursorHeight", 1), tr("workTime", 100), tr("workDelay", 100), tr("flattenSpans", !0), tr("pollInterval", 100), tr("undoDepth", 40, function(e, t) {
3350
- e.doc.history.undoDepth = t
3351
- }), tr("historyEventDelay", 500), tr("viewportMargin", 10, function(e) {
3352
- e.refresh()
3353
- }, !0), tr("maxHighlightLength", 1e4, function(e) {
3354
- N(e), e.refresh()
3355
- }, !0), tr("crudeMeasuringFrom", 1e4), tr("moveInputWithCursor", !0, function(e, t) {
3356
- t || (e.display.inputDiv.style.top = e.display.inputDiv.style.left = 0)
3357
- }), tr("tabindex", null, function(e, t) {
3358
- e.display.input.tabIndex = t || ""
3359
- }), tr("autofocus", null);
3360
- var rr = x.modes = {}, ir = x.mimeModes = {};
3361
- x.defineMode = function(e, t) {
3362
- !x.defaults.mode && e != "null" && (x.defaults.mode = e);
3363
- if (arguments.length > 2) {
3364
- t.dependencies = [];
3365
- for (var n = 2; n < arguments.length; ++n)
3366
- t.dependencies.push(arguments[n])
3367
- }
3368
- rr[e] = t
3369
- }, x.defineMIME = function(e, t) {
3370
- ir[e] = t
3371
- }, x.resolveMode = function(e) {
3372
- if (typeof e == "string" && ir.hasOwnProperty(e))
3373
- e = ir[e];
3374
- else if (e && typeof e.name == "string" && ir.hasOwnProperty(e.name)) {
3375
- var t = ir[e.name];
3376
- e = rs(t, e), e.name = t.name
3377
- } else if (typeof e == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(e))
3378
- return x.resolveMode("application/xml");
3379
- return typeof e == "string" ? {
3380
- name: e
3381
- } : e || {
3382
- name: "null"
3383
- }
3384
- }, x.getMode = function(e, t) {
3385
- var t = x.resolveMode(t), n = rr[t.name];
3386
- if (!n)
3387
- return x.getMode(e, "text/plain");
3388
- var r = n(e, t);
3389
- if (sr.hasOwnProperty(t.name)) {
3390
- var i = sr[t.name];
3391
- for (var s in i) {
3392
- if (!i.hasOwnProperty(s))
3393
- continue;
3394
- r.hasOwnProperty(s) && (r["_" + s] = r[s]), r[s] = i[s]
3395
- }
3396
- }
3397
- return r.name = t.name, r
3398
- }, x.defineMode("null", function() {
3399
- return {
3400
- token: function(e) {
3401
- e.skipToEnd()
3402
- }
3403
- }
3404
- }), x.defineMIME("text/plain", "null");
3405
- var sr = x.modeExtensions = {};
3406
- x.extendMode = function(e, t) {
3407
- var n = sr.hasOwnProperty(e) ? sr[e]: sr[e] = {};
3408
- is(t, n)
3409
- }, x.defineExtension = function(e, t) {
3410
- x.prototype[e] = t
3411
- }, x.defineDocExtension = function(e, t) {
3412
- ui.prototype[e] = t
3413
- }, x.defineOption = tr;
3414
- var or = [];
3415
- x.defineInitHook = function(e) {
3416
- or.push(e)
3417
- };
3418
- var ur = x.helpers = {};
3419
- x.registerHelper = function(e, t, n) {
3420
- ur.hasOwnProperty(e) || (ur[e] = x[e] = {}), ur[e][t] = n
3421
- }, x.isWordChar = as, x.copyState = ar, x.startState = fr, x.innerMode = function(e, t) {
3422
- while (e.innerMode) {
3423
- var n = e.innerMode(t);
3424
- if (!n || n.mode == e)
3425
- break;
3426
- t = n.state, e = n.mode
3427
- }
3428
- return n || {
3429
- mode: e,
3430
- state: t
3431
- }
3432
- };
3433
- var lr = x.commands = {
3434
- selectAll: function(e) {
3435
- e.setSelection(Ln(e.firstLine(), 0), Ln(e.lastLine()))
3436
- },
3437
- killLine: function(e) {
3438
- var t = e.getCursor(!0), n = e.getCursor(!1), r=!An(t, n);
3439
- !r && e.getLine(t.line).length == t.ch ? e.replaceRange("", t, Ln(t.line + 1, 0), "+delete") : e.replaceRange("", t, r ? n : Ln(t.line), "+delete")
3440
- },
3441
- deleteLine: function(e) {
3442
- var t = e.getCursor().line;
3443
- e.replaceRange("", Ln(t, 0), Ln(t), "+delete")
3444
- },
3445
- delLineLeft: function(e) {
3446
- var t = e.getCursor();
3447
- e.replaceRange("", Ln(t.line, 0), t, "+delete")
3448
- },
3449
- undo: function(e) {
3450
- e.undo()
3451
- },
3452
- redo: function(e) {
3453
- e.redo()
3454
- },
3455
- goDocStart: function(e) {
3456
- e.extendSelection(Ln(e.firstLine(), 0))
3457
- },
3458
- goDocEnd: function(e) {
3459
- e.extendSelection(Ln(e.lastLine()))
3460
- },
3461
- goLineStart: function(e) {
3462
- e.extendSelection(Ms(e, e.getCursor().line))
3463
- },
3464
- goLineStartSmart: function(e) {
3465
- var t = e.getCursor(), n = Ms(e, t.line), r = e.getLineHandle(n.line), i = bi(r);
3466
- if (!i || i[0].level == 0) {
3467
- var s = Math.max(0, r.text.search(/\S/)), o = t.line == n.line && t.ch <= s && t.ch;
3468
- e.extendSelection(Ln(n.line, o ? 0 : s))
3469
- } else
3470
- e.extendSelection(n)
3471
- },
3472
- goLineEnd: function(e) {
3473
- e.extendSelection(_s(e, e.getCursor().line))
3474
- },
3475
- goLineRight: function(e) {
3476
- var t = e.charCoords(e.getCursor(), "div").top + 5;
3477
- e.extendSelection(e.coordsChar({
3478
- left: e.display.lineDiv.offsetWidth + 100,
3479
- top: t
3480
- }, "div"))
3481
- },
3482
- goLineLeft: function(e) {
3483
- var t = e.charCoords(e.getCursor(), "div").top + 5;
3484
- e.extendSelection(e.coordsChar({
3485
- left: 0,
3486
- top: t
3487
- }, "div"))
3488
- },
3489
- goLineUp: function(e) {
3490
- e.moveV(-1, "line")
3491
- },
3492
- goLineDown: function(e) {
3493
- e.moveV(1, "line")
3494
- },
3495
- goPageUp: function(e) {
3496
- e.moveV(-1, "page")
3497
- },
3498
- goPageDown: function(e) {
3499
- e.moveV(1, "page")
3500
- },
3501
- goCharLeft: function(e) {
3502
- e.moveH(-1, "char")
3503
- },
3504
- goCharRight: function(e) {
3505
- e.moveH(1, "char")
3506
- },
3507
- goColumnLeft: function(e) {
3508
- e.moveH(-1, "column")
3509
- },
3510
- goColumnRight: function(e) {
3511
- e.moveH(1, "column")
3512
- },
3513
- goWordLeft: function(e) {
3514
- e.moveH(-1, "word")
3515
- },
3516
- goGroupRight: function(e) {
3517
- e.moveH(1, "group")
3518
- },
3519
- goGroupLeft: function(e) {
3520
- e.moveH(-1, "group")
3521
- },
3522
- goWordRight: function(e) {
3523
- e.moveH(1, "word")
3524
- },
3525
- delCharBefore: function(e) {
3526
- e.deleteH(-1, "char")
3527
- },
3528
- delCharAfter: function(e) {
3529
- e.deleteH(1, "char")
3530
- },
3531
- delWordBefore: function(e) {
3532
- e.deleteH(-1, "word")
3533
- },
3534
- delWordAfter: function(e) {
3535
- e.deleteH(1, "word")
3536
- },
3537
- delGroupBefore: function(e) {
3538
- e.deleteH(-1, "group")
3539
- },
3540
- delGroupAfter: function(e) {
3541
- e.deleteH(1, "group")
3542
- },
3543
- indentAuto: function(e) {
3544
- e.indentSelection("smart")
3545
- },
3546
- indentMore: function(e) {
3547
- e.indentSelection("add")
3548
- },
3549
- indentLess: function(e) {
3550
- e.indentSelection("subtract")
3551
- },
3552
- insertTab: function(e) {
3553
- e.replaceSelection(" ", "end", "+input")
3554
- },
3555
- defaultTab: function(e) {
3556
- e.somethingSelected() ? e.indentSelection("add") : e.replaceSelection(" ", "end", "+input")
3557
- },
3558
- transposeChars: function(e) {
3559
- var t = e.getCursor(), n = e.getLine(t.line);
3560
- t.ch > 0 && t.ch < n.length-1 && e.replaceRange(n.charAt(t.ch) + n.charAt(t.ch-1), Ln(t.line, t.ch-1), Ln(t.line, t.ch + 1))
3561
- },
3562
- newlineAndIndent: function(e) {
3563
- Mt(e, function() {
3564
- e.replaceSelection("\n", "end", "+input"), e.indentLine(e.getCursor().line, null, !0)
3565
- })()
3566
- },
3567
- toggleOverwrite: function(e) {
3568
- e.toggleOverwrite()
3569
- }
3570
- }, cr = x.keyMap = {};
3571
- cr.basic = {
3572
- Left: "goCharLeft",
3573
- Right: "goCharRight",
3574
- Up: "goLineUp",
3575
- Down: "goLineDown",
3576
- End: "goLineEnd",
3577
- Home: "goLineStartSmart",
3578
- PageUp: "goPageUp",
3579
- PageDown: "goPageDown",
3580
- Delete: "delCharAfter",
3581
- Backspace: "delCharBefore",
3582
- "Shift-Backspace": "delCharBefore",
3583
- Tab: "defaultTab",
3584
- "Shift-Tab": "indentAuto",
3585
- Enter: "newlineAndIndent",
3586
- Insert: "toggleOverwrite"
3587
- }, cr.pcDefault = {
3588
- "Ctrl-A": "selectAll",
3589
- "Ctrl-D": "deleteLine",
3590
- "Ctrl-Z": "undo",
3591
- "Shift-Ctrl-Z": "redo",
3592
- "Ctrl-Y": "redo",
3593
- "Ctrl-Home": "goDocStart",
3594
- "Alt-Up": "goDocStart",
3595
- "Ctrl-End": "goDocEnd",
3596
- "Ctrl-Down": "goDocEnd",
3597
- "Ctrl-Left": "goGroupLeft",
3598
- "Ctrl-Right": "goGroupRight",
3599
- "Alt-Left": "goLineStart",
3600
- "Alt-Right": "goLineEnd",
3601
- "Ctrl-Backspace": "delGroupBefore",
3602
- "Ctrl-Delete": "delGroupAfter",
3603
- "Ctrl-S": "save",
3604
- "Ctrl-F": "find",
3605
- "Ctrl-G": "findNext",
3606
- "Shift-Ctrl-G": "findPrev",
3607
- "Shift-Ctrl-F": "replace",
3608
- "Shift-Ctrl-R": "replaceAll",
3609
- "Ctrl-[": "indentLess",
3610
- "Ctrl-]": "indentMore",
3611
- fallthrough: "basic"
3612
- }, cr.macDefault = {
3613
- "Cmd-A": "selectAll",
3614
- "Cmd-D": "deleteLine",
3615
- "Cmd-Z": "undo",
3616
- "Shift-Cmd-Z": "redo",
3617
- "Cmd-Y": "redo",
3618
- "Cmd-Up": "goDocStart",
3619
- "Cmd-End": "goDocEnd",
3620
- "Cmd-Down": "goDocEnd",
3621
- "Alt-Left": "goGroupLeft",
3622
- "Alt-Right": "goGroupRight",
3623
- "Cmd-Left": "goLineStart",
3624
- "Cmd-Right": "goLineEnd",
3625
- "Alt-Backspace": "delGroupBefore",
3626
- "Ctrl-Alt-Backspace": "delGroupAfter",
3627
- "Alt-Delete": "delGroupAfter",
3628
- "Cmd-S": "save",
3629
- "Cmd-F": "find",
3630
- "Cmd-G": "findNext",
3631
- "Shift-Cmd-G": "findPrev",
3632
- "Cmd-Alt-F": "replace",
3633
- "Shift-Cmd-Alt-F": "replaceAll",
3634
- "Cmd-[": "indentLess",
3635
- "Cmd-]": "indentMore",
3636
- "Cmd-Backspace": "delLineLeft",
3637
- fallthrough: ["basic", "emacsy"]
3638
- }, cr["default"] = m ? cr.macDefault : cr.pcDefault, cr.emacsy = {
3639
- "Ctrl-F": "goCharRight",
3640
- "Ctrl-B": "goCharLeft",
3641
- "Ctrl-P": "goLineUp",
3642
- "Ctrl-N": "goLineDown",
3643
- "Alt-F": "goWordRight",
3644
- "Alt-B": "goWordLeft",
3645
- "Ctrl-A": "goLineStart",
3646
- "Ctrl-E": "goLineEnd",
3647
- "Ctrl-V": "goPageDown",
3648
- "Shift-Ctrl-V": "goPageUp",
3649
- "Ctrl-D": "delCharAfter",
3650
- "Ctrl-H": "delCharBefore",
3651
- "Alt-D": "delWordAfter",
3652
- "Alt-Backspace": "delWordBefore",
3653
- "Ctrl-K": "killLine",
3654
- "Ctrl-T": "transposeChars"
3655
- }, x.lookupKey = pr, x.isModifierKey = dr, x.keyName = vr, x.fromTextArea = function(e, t) {
3656
- function i() {
3657
- e.value = a.getValue()
3658
- }
3659
- t || (t = {}), t.value = e.value, !t.tabindex && e.tabindex && (t.tabindex = e.tabindex), !t.placeholder && e.placeholder && (t.placeholder = e.placeholder);
3660
- if (t.autofocus == null) {
3661
- var n = document.body;
3662
- try {
3663
- n = document.activeElement
3664
- } catch (r) {}
3665
- t.autofocus = n == e || e.getAttribute("autofocus") != null && n == document.body
3666
- }
3667
- if (e.form) {
3668
- Fi(e.form, "submit", i);
3669
- if (!t.leaveSubmitMethodAlone) {
3670
- var s = e.form, o = s.submit;
3671
- try {
3672
- var u = s.submit = function() {
3673
- i(), s.submit = o, s.submit(), s.submit = u
3674
- }
3675
- } catch (r) {}
3676
- }
3677
- }
3678
- e.style.display = "none";
3679
- var a = x(function(t) {
3680
- e.parentNode.insertBefore(t, e.nextSibling)
3681
- }, t);
3682
- return a.save = i, a.getTextArea = function() {
3683
- return e
3684
- }, a.toTextArea = function() {
3685
- i(), e.parentNode.removeChild(a.getWrapperElement()), e.style.display = "", e.form && (Ii(e.form, "submit", i), typeof e.form.submit == "function" && (e.form.submit = o))
3686
- }, a
3687
- }, mr.prototype = {
3688
- eol: function() {
3689
- return this.pos >= this.string.length
3690
- },
3691
- sol: function() {
3692
- return this.pos == 0
3693
- },
3694
- peek: function() {
3695
- return this.string.charAt(this.pos) || undefined
3696
- },
3697
- next: function() {
3698
- if (this.pos < this.string.length)
3699
- return this.string.charAt(this.pos++)
3700
- },
3701
- eat: function(e) {
3702
- var t = this.string.charAt(this.pos);
3703
- if (typeof e == "string")
3704
- var n = t == e;
3705
- else
3706
- var n = t && (e.test ? e.test(t) : e(t));
3707
- if (n)
3708
- return ++this.pos, t
3709
- },
3710
- eatWhile: function(e) {
3711
- var t = this.pos;
3712
- while (this.eat(e));
3713
- return this.pos > t
3714
- },
3715
- eatSpace: function() {
3716
- var e = this.pos;
3717
- while (/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;
3718
- return this.pos > e
3719
- },
3720
- skipToEnd: function() {
3721
- this.pos = this.string.length
3722
- },
3723
- skipTo: function(e) {
3724
- var t = this.string.indexOf(e, this.pos);
3725
- if (t>-1)
3726
- return this.pos = t, !0
3727
- },
3728
- backUp: function(e) {
3729
- this.pos -= e
3730
- },
3731
- column: function() {
3732
- return this.lastColumnPos < this.start && (this.lastColumnValue = Gi(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue), this.lastColumnPos = this.start), this.lastColumnValue
3733
- },
3734
- indentation: function() {
3735
- return Gi(this.string, null, this.tabSize)
3736
- },
3737
- match: function(e, t, n) {
3738
- if (typeof e != "string") {
3739
- var s = this.string.slice(this.pos).match(e);
3740
- return s && s.index > 0 ? null : (s && t!==!1 && (this.pos += s[0].length), s)
3741
- }
3742
- var r = function(e) {
3743
- return n ? e.toLowerCase() : e
3744
- }, i = this.string.substr(this.pos, e.length);
3745
- if (r(i) == r(e))
3746
- return t!==!1 && (this.pos += e.length), !0
3747
- },
3748
- current: function() {
3749
- return this.string.slice(this.start, this.pos)
3750
- }
3751
- }, x.StringStream = mr, x.TextMarker = gr, $i(gr), gr.prototype.clear = function() {
3752
- if (this.explicitlyCleared)
3753
- return;
3754
- var e = this.doc.cm, t = e&&!e.curOp;
3755
- t && At(e);
3756
- if (Vi(this, "clear")) {
3757
- var n = this.find();
3758
- n && zi(this, "clear", n.from, n.to)
3759
- }
3760
- var r = null, i = null;
3761
- for (var s = 0; s < this.lines.length; ++s) {
3762
- var o = this.lines[s], u = Er(o.markedSpans, this);
3763
- u.to != null && (i = mi(o)), o.markedSpans = Sr(o.markedSpans, u), u.from != null ? r = mi(o) : this.collapsed&&!Dr(this.doc, o) && e && vi(o, Ct(e.display))
3764
- }
3765
- if (e && this.collapsed&&!e.options.lineWrapping)
3766
- for (var s = 0; s < this.lines.length; ++s) {
3767
- var a = _r(e.doc, this.lines[s]), f = D(e.doc, a);
3768
- f > e.display.maxLineLength && (e.display.maxLine = a, e.display.maxLineLength = f, e.display.maxLineChanged=!0)
3769
- }
3770
- r != null && e && Pt(e, r, i + 1), this.lines.length = 0, this.explicitlyCleared=!0, this.atomic && this.doc.cantEdit && (this.doc.cantEdit=!1, e && In(e)), t && Ot(e)
3771
- }, gr.prototype.find = function() {
3772
- var e, t;
3773
- for (var n = 0; n < this.lines.length; ++n) {
3774
- var r = this.lines[n], i = Er(r.markedSpans, this);
3775
- if (i.from != null || i.to != null) {
3776
- var s = mi(r);
3777
- i.from != null && (e = Ln(s, i.from)), i.to != null && (t = Ln(s, i.to))
3778
- }
3779
- }
3780
- return this.type == "bookmark" ? e : e && {
3781
- from: e,
3782
- to: t
3783
- }
3784
- }, gr.prototype.changed = function() {
3785
- var e = this.find(), t = this.doc.cm;
3786
- if (!e ||!t)
3787
- return;
3788
- this.type != "bookmark" && (e = e.from);
3789
- var n = hi(this.doc, e.line);
3790
- lt(t, n);
3791
- if (e.line >= t.display.showingFrom && e.line < t.display.showingTo) {
3792
- for (var r = t.display.lineDiv.firstChild; r; r = r.nextSibling)
3793
- if (r.lineObj == n) {
3794
- r.offsetHeight != n.height && vi(n, r.offsetHeight);
3795
- break
3796
- }
3797
- Dt(t, function() {
3798
- t.curOp.selectionChanged = t.curOp.forceUpdate = t.curOp.updateMaxLine=!0
3799
- })
3800
- }
3801
- }, gr.prototype.attachLine = function(e) {
3802
- if (!this.lines.length && this.doc.cm) {
3803
- var t = this.doc.cm.curOp;
3804
- (!t.maybeHiddenMarkers || ns(t.maybeHiddenMarkers, this)==-1) && (t.maybeUnhiddenMarkers || (t.maybeUnhiddenMarkers = [])).push(this)
3805
- }
3806
- this.lines.push(e)
3807
- }, gr.prototype.detachLine = function(e) {
3808
- this.lines.splice(ns(this.lines, e), 1);
3809
- if (!this.lines.length && this.doc.cm) {
3810
- var t = this.doc.cm.curOp;
3811
- (t.maybeHiddenMarkers || (t.maybeHiddenMarkers = [])).push(this)
3812
- }
3813
- }, x.SharedTextMarker = br, $i(br), br.prototype.clear = function() {
3814
- if (this.explicitlyCleared)
3815
- return;
3816
- this.explicitlyCleared=!0;
3817
- for (var e = 0; e < this.markers.length; ++e)
3818
- this.markers[e].clear();
3819
- zi(this, "clear")
3820
- }, br.prototype.find = function() {
3821
- return this.primary.find()
3822
- };
3823
- var jr = x.LineWidget = function(e, t, n) {
3824
- if (n)
3825
- for (var r in n)
3826
- n.hasOwnProperty(r) && (this[r] = n[r]);
3827
- this.cm = e, this.node = t
3828
- };
3829
- $i(jr), jr.prototype.clear = Fr(function() {
3830
- var e = this.line.widgets, t = mi(this.line);
3831
- if (t == null ||!e)
3832
- return;
3833
- for (var n = 0; n < e.length; ++n)
3834
- e[n] == this && e.splice(n--, 1);
3835
- e.length || (this.line.widgets = null);
3836
- var r = yi(this.cm, this.line) < this.cm.doc.scrollTop;
3837
- vi(this.line, Math.max(0, this.line.height - Ir(this))), r && Vn(this.cm, 0, - this.height), Pt(this.cm, t, t + 1)
3838
- }), jr.prototype.changed = Fr(function() {
3839
- var e = this.height;
3840
- this.height = null;
3841
- var t = Ir(this) - e;
3842
- if (!t)
3843
- return;
3844
- vi(this.line, this.line.height + t);
3845
- var n = mi(this.line);
3846
- Pt(this.cm, n, n + 1)
3847
- });
3848
- var Rr = x.Line = function(e, t, n) {
3849
- this.text = e, Br(this, t), this.height = n ? n(this) : 1
3850
- };
3851
- $i(Rr), Rr.prototype.lineNo = function() {
3852
- return mi(this)
3853
- };
3854
- var Jr = {};
3855
- ii.prototype = {
3856
- chunkSize: function() {
3857
- return this.lines.length
3858
- },
3859
- removeInner: function(e, t) {
3860
- for (var n = e, r = e + t; n < r; ++n) {
3861
- var i = this.lines[n];
3862
- this.height -= i.height, zr(i), zi(i, "delete")
3863
- }
3864
- this.lines.splice(e, t)
3865
- },
3866
- collapse: function(e) {
3867
- e.splice.apply(e, [e.length, 0].concat(this.lines))
3868
- },
3869
- insertInner: function(e, t, n) {
3870
- this.height += n, this.lines = this.lines.slice(0, e).concat(t).concat(this.lines.slice(e));
3871
- for (var r = 0, i = t.length; r < i; ++r)
3872
- t[r].parent = this
3873
- },
3874
- iterN: function(e, t, n) {
3875
- for (var r = e + t; e < r; ++e)
3876
- if (n(this.lines[e]))
3877
- return !0
3878
- }
3879
- }, si.prototype = {
3880
- chunkSize: function() {
3881
- return this.size
3882
- },
3883
- removeInner: function(e, t) {
3884
- this.size -= t;
3885
- for (var n = 0; n < this.children.length; ++n) {
3886
- var r = this.children[n], i = r.chunkSize();
3887
- if (e < i) {
3888
- var s = Math.min(t, i - e), o = r.height;
3889
- r.removeInner(e, s), this.height -= o - r.height, i == s && (this.children.splice(n--, 1), r.parent = null);
3890
- if ((t -= s) == 0)
3891
- break;
3892
- e = 0
3893
- } else
3894
- e -= i
3895
- }
3896
- if (this.size - t < 25) {
3897
- var u = [];
3898
- this.collapse(u), this.children = [new ii(u)], this.children[0].parent = this
3899
- }
3900
- },
3901
- collapse: function(e) {
3902
- for (var t = 0, n = this.children.length; t < n; ++t)
3903
- this.children[t].collapse(e)
3904
- },
3905
- insertInner: function(e, t, n) {
3906
- this.size += t.length, this.height += n;
3907
- for (var r = 0, i = this.children.length; r < i; ++r) {
3908
- var s = this.children[r], o = s.chunkSize();
3909
- if (e <= o) {
3910
- s.insertInner(e, t, n);
3911
- if (s.lines && s.lines.length > 50) {
3912
- while (s.lines.length > 50) {
3913
- var u = s.lines.splice(s.lines.length-25, 25), a = new ii(u);
3914
- s.height -= a.height, this.children.splice(r + 1, 0, a), a.parent = this
3915
- }
3916
- this.maybeSpill()
3917
- }
3918
- break
3919
- }
3920
- e -= o
3921
- }
3922
- },
3923
- maybeSpill: function() {
3924
- if (this.children.length <= 10)
3925
- return;
3926
- var e = this;
3927
- do {
3928
- var t = e.children.splice(e.children.length-5, 5), n = new si(t);
3929
- if (!e.parent) {
3930
- var r = new si(e.children);
3931
- r.parent = e, e.children = [r, n], e = r
3932
- } else {
3933
- e.size -= n.size, e.height -= n.height;
3934
- var i = ns(e.parent.children, e);
3935
- e.parent.children.splice(i + 1, 0, n)
3936
- }
3937
- n.parent = e.parent
3938
- }
3939
- while (e.children.length > 10);
3940
- e.parent.maybeSpill()
3941
- },
3942
- iterN: function(e, t, n) {
3943
- for (var r = 0, i = this.children.length; r < i; ++r) {
3944
- var s = this.children[r], o = s.chunkSize();
3945
- if (e < o) {
3946
- var u = Math.min(t, o - e);
3947
- if (s.iterN(e, u, n))
3948
- return !0;
3949
- if ((t -= u) == 0)
3950
- break;
3951
- e = 0
3952
- } else
3953
- e -= o
3954
- }
3955
- }
3956
- };
3957
- var oi = 0, ui = x.Doc = function(e, t, n) {
3958
- if (!(this instanceof ui))
3959
- return new ui(e, t, n);
3960
- n == null && (n = 0), si.call(this, [new ii([new Rr("", null)])]), this.first = n, this.scrollTop = this.scrollLeft = 0, this.cantEdit=!1, this.history = wi(), this.cleanGeneration = 1, this.frontier = n;
3961
- var r = Ln(n, 0);
3962
- this.sel = {
3963
- from: r,
3964
- to: r,
3965
- head: r,
3966
- anchor: r,
3967
- shift: !1,
3968
- extend: !1,
3969
- goalColumn: null
3970
- }, this.id=++oi, this.modeOption = t, typeof e == "string" && (e = Ss(e)), ri(this, {
3971
- from: r,
3972
- to: r,
3973
- text: e
3974
- }, null, {
3975
- head: r,
3976
- anchor: r
3977
- })
3978
- };
3979
- ui.prototype = rs(si.prototype, {
3980
- constructor: ui,
3981
- iter: function(e, t, n) {
3982
- n ? this.iterN(e - this.first, t - e, n) : this.iterN(this.first, this.first + this.size, e)
3983
- },
3984
- insert: function(e, t) {
3985
- var n = 0;
3986
- for (var r = 0, i = t.length; r < i; ++r)
3987
- n += t[r].height;
3988
- this.insertInner(e - this.first, t, n)
3989
- },
3990
- remove: function(e, t) {
3991
- this.removeInner(e - this.first, t)
3992
- },
3993
- getValue: function(e) {
3994
- var t = di(this, this.first, this.first + this.size);
3995
- return e===!1 ? t : t.join(e || "\n")
3996
- },
3997
- setValue: function(e) {
3998
- var t = Ln(this.first, 0), n = this.first + this.size-1;
3999
- En(this, {
4000
- from: t,
4001
- to: Ln(n, hi(this, n).text.length),
4002
- text: Ss(e),
4003
- origin: "setValue"
4004
- }, {
4005
- head: t,
4006
- anchor: t
4007
- }, !0)
4008
- },
4009
- replaceRange: function(e, t, n, r) {
4010
- t = Dn(this, t), n = n ? Dn(this, n) : t, kn(this, e, t, n, r)
4011
- },
4012
- getRange: function(e, t, n) {
4013
- var r = pi(this, Dn(this, e), Dn(this, t));
4014
- return n===!1 ? r : r.join(n || "\n")
4015
- },
4016
- getLine: function(e) {
4017
- var t = this.getLineHandle(e);
4018
- return t && t.text
4019
- },
4020
- setLine: function(e, t) {
4021
- Hn(this, e) && kn(this, t, Ln(e, 0), Dn(this, Ln(e)))
4022
- },
4023
- removeLine: function(e) {
4024
- e ? kn(this, "", Dn(this, Ln(e-1)), Dn(this, Ln(e))) : kn(this, "", Ln(0, 0), Dn(this, Ln(1, 0)))
4025
- },
4026
- getLineHandle: function(e) {
4027
- if (Hn(this, e))
4028
- return hi(this, e)
4029
- },
4030
- getLineNumber: function(e) {
4031
- return mi(e)
4032
- },
4033
- getLineHandleVisualStart: function(e) {
4034
- return typeof e == "number" && (e = hi(this, e)), _r(this, e)
4035
- },
4036
- lineCount: function() {
4037
- return this.size
4038
- },
4039
- firstLine: function() {
4040
- return this.first
4041
- },
4042
- lastLine: function() {
4043
- return this.first + this.size-1
4044
- },
4045
- clipPos: function(e) {
4046
- return Dn(this, e)
4047
- },
4048
- getCursor: function(e) {
4049
- var t = this.sel, n;
4050
- return e == null || e == "head" ? n = t.head : e == "anchor" ? n = t.anchor : e == "end" || e===!1 ? n = t.to : n = t.from, Mn(n)
4051
- },
4052
- somethingSelected: function() {
4053
- return !An(this.sel.head, this.sel.anchor)
4054
- },
4055
- setCursor: _t(function(e, t, n) {
4056
- var r = Dn(this, typeof e == "number" ? Ln(e, t || 0) : e);
4057
- n ? Bn(this, r) : Fn(this, r, r)
4058
- }),
4059
- setSelection: _t(function(e, t, n) {
4060
- Fn(this, Dn(this, e), Dn(this, t || e), n)
4061
- }),
4062
- extendSelection: _t(function(e, t, n) {
4063
- Bn(this, Dn(this, e), t && Dn(this, t), n)
4064
- }),
4065
- getSelection: function(e) {
4066
- return this.getRange(this.sel.from, this.sel.to, e)
4067
- },
4068
- replaceSelection: function(e, t, n) {
4069
- En(this, {
4070
- from: this.sel.from,
4071
- to: this.sel.to,
4072
- text: Ss(e),
4073
- origin: n
4074
- }, t || "around")
4075
- },
4076
- undo: _t(function() {
4077
- xn(this, "undo")
4078
- }),
4079
- redo: _t(function() {
4080
- xn(this, "redo")
4081
- }),
4082
- setExtending: function(e) {
4083
- this.sel.extend = e
4084
- },
4085
- historySize: function() {
4086
- var e = this.history;
4087
- return {
4088
- undo: e.done.length,
4089
- redo: e.undone.length
4090
- }
4091
- },
4092
- clearHistory: function() {
4093
- this.history = wi(this.history.maxGeneration)
4094
- },
4095
- markClean: function() {
4096
- this.cleanGeneration = this.changeGeneration()
4097
- },
4098
- changeGeneration: function() {
4099
- return this.history.lastOp = this.history.lastOrigin = null, this.history.generation
4100
- },
4101
- isClean: function(e) {
4102
- return this.history.generation == (e || this.cleanGeneration)
4103
- },
4104
- getHistory: function() {
4105
- return {
4106
- done: Ci(this.history.done),
4107
- undone: Ci(this.history.undone)
4108
- }
4109
- },
4110
- setHistory: function(e) {
4111
- var t = this.history = wi(this.history.maxGeneration);
4112
- t.done = e.done.slice(0), t.undone = e.undone.slice(0)
4113
- },
4114
- markText: function(e, t, n) {
4115
- return yr(this, Dn(this, e), Dn(this, t), n, "range")
4116
- },
4117
- setBookmark: function(e, t) {
4118
- var n = {
4119
- replacedWith: t && (t.nodeType == null ? t.widget : t),
4120
- insertLeft: t && t.insertLeft
4121
- };
4122
- return e = Dn(this, e), yr(this, e, e, n, "bookmark")
4123
- },
4124
- findMarksAt: function(e) {
4125
- e = Dn(this, e);
4126
- var t = [], n = hi(this, e.line).markedSpans;
4127
- if (n)
4128
- for (var r = 0; r < n.length; ++r) {
4129
- var i = n[r];
4130
- (i.from == null || i.from <= e.ch) && (i.to == null || i.to >= e.ch) && t.push(i.marker.parent || i.marker)
4131
- }
4132
- return t
4133
- },
4134
- getAllMarks: function() {
4135
- var e = [];
4136
- return this.iter(function(t) {
4137
- var n = t.markedSpans;
4138
- if (n)
4139
- for (var r = 0; r < n.length; ++r)
4140
- n[r].from != null && e.push(n[r].marker)
4141
- }), e
4142
- },
4143
- posFromIndex: function(e) {
4144
- var t, n = this.first;
4145
- return this.iter(function(r) {
4146
- var i = r.text.length + 1;
4147
- if (i > e)
4148
- return t = e, !0;
4149
- e -= i, ++n
4150
- }), Dn(this, Ln(n, t))
4151
- },
4152
- indexFromPos: function(e) {
4153
- e = Dn(this, e);
4154
- var t = e.ch;
4155
- return e.line < this.first || e.ch < 0 ? 0 : (this.iter(this.first, e.line, function(e) {
4156
- t += e.text.length + 1
4157
- }), t)
4158
- },
4159
- copy: function(e) {
4160
- var t = new ui(di(this, this.first, this.first + this.size), this.modeOption, this.first);
4161
- return t.scrollTop = this.scrollTop, t.scrollLeft = this.scrollLeft, t.sel = {
4162
- from: this.sel.from,
4163
- to: this.sel.to,
4164
- head: this.sel.head,
4165
- anchor: this.sel.anchor,
4166
- shift: this.sel.shift,
4167
- extend: !1,
4168
- goalColumn: this.sel.goalColumn
4169
- }, e && (t.history.undoDepth = this.history.undoDepth, t.setHistory(this.getHistory())), t
4170
- },
4171
- linkedDoc: function(e) {
4172
- e || (e = {});
4173
- var t = this.first, n = this.first + this.size;
4174
- e.from != null && e.from > t && (t = e.from), e.to != null && e.to < n && (n = e.to);
4175
- var r = new ui(di(this, t, n), e.mode || this.modeOption, t);
4176
- return e.sharedHist && (r.history = this.history), (this.linked || (this.linked = [])).push({
4177
- doc: r,
4178
- sharedHist: e.sharedHist
4179
- }), r.linked = [{
4180
- doc: this,
4181
- isParent: !0,
4182
- sharedHist: e.sharedHist
4183
- }
4184
- ], r
4185
- },
4186
- unlinkDoc: function(e) {
4187
- e instanceof x && (e = e.doc);
4188
- if (this.linked)
4189
- for (var t = 0; t < this.linked.length; ++t) {
4190
- var n = this.linked[t];
4191
- if (n.doc != e)
4192
- continue;
4193
- this.linked.splice(t, 1), e.unlinkDoc(this);
4194
- break
4195
- }
4196
- if (e.history == this.history) {
4197
- var r = [e.id];
4198
- li(e, function(e) {
4199
- r.push(e.id)
4200
- }, !0), e.history = wi(), e.history.done = Ci(this.history.done, r), e.history.undone = Ci(this.history.undone, r)
4201
- }
4202
- },
4203
- iterLinkedDocs: function(e) {
4204
- li(this, e)
4205
- },
4206
- getMode: function() {
4207
- return this.mode
4208
- },
4209
- getEditor: function() {
4210
- return this.cm
4211
- }
4212
- }), ui.prototype.eachLine = ui.prototype.iter;
4213
- var ai = "iter insert remove copy getEditor".split(" ");
4214
- for (var fi in ui.prototype)
4215
- ui.prototype.hasOwnProperty(fi) && ns(ai, fi) < 0 && (x.prototype[fi] = function(e) {
4216
- return function() {
4217
- return e.apply(this.doc, arguments)
4218
- }
4219
- }(ui.prototype[fi]));
4220
- $i(ui), x.e_stop = Hi, x.e_preventDefault = _i, x.e_stopPropagation = Di;
4221
- var Ri, Ui = 0;
4222
- x.on = Fi, x.off = Ii, x.signal = qi;
4223
- var Ji = 30, Ki = x.Pass = {
4224
- toString: function() {
4225
- return "CodeMirror.Pass"
4226
- }
4227
- };
4228
- Qi.prototype = {
4229
- set: function(e, t) {
4230
- clearTimeout(this.id), this.id = setTimeout(t, e)
4231
- }
4232
- }, x.countColumn = Gi;
4233
- var Yi = [""], us = /[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/, ls = /[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\u1DC0–\u1DFF\u20D0–\u20FF\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff\uFE20–\uFE2F]/;
4234
- x.replaceGetRect = function(e) {
4235
- vs = e
4236
- };
4237
- var ms = function() {
4238
- if (r)
4239
- return !1;
4240
- var e = cs("div");
4241
- return "draggable"in e || "dragDrop"in e
4242
- }();
4243
- e ? gs = function(e, t) {
4244
- return e.charCodeAt(t-1) == 36 && e.charCodeAt(t) == 39
4245
- } : f&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent) ? gs = function(e, t) {
4246
- return /\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(e.slice(t-1, t + 1))
4247
- } : s && /Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent) ? gs = function(e, t) {
4248
- var n = e.charCodeAt(t-1);
4249
- return n >= 8208 && n <= 8212
4250
- } : s && (gs = function(e, t) {
4251
- if (t > 1 && e.charCodeAt(t-1) == 45) {
4252
- if (/\w/.test(e.charAt(t-2)) && /[^\-?\.]/.test(e.charAt(t)))
4253
- return !0;
4254
- if (t > 2 && /[\d\.,]/.test(e.charAt(t-2)) && /[\d\.,]/.test(e.charAt(t)))
4255
- return !1
4256
- }
4257
- return /[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(e.slice(t-1, t + 1))
4258
- });
4259
- var ys, ws, Ss = "\n\nb".split(/\n/).length != 3 ? function(e) {
4260
- var t = 0, n = [], r = e.length;
4261
- while (t <= r) {
4262
- var i = e.indexOf("\n", t);
4263
- i==-1 && (i = e.length);
4264
- var s = e.slice(t, e.charAt(i-1) == "\r" ? i-1 : i), o = s.indexOf("\r");
4265
- o!=-1 ? (n.push(s.slice(0, o)), t += o + 1) : (n.push(s), t = i + 1)
4266
- }
4267
- return n
4268
- }
4269
- : function(e) {
4270
- return e.split(/\r\n?|\n/)
4271
- };
4272
- x.splitLines = Ss;
4273
- var xs = window.getSelection ? function(e) {
4274
- try {
4275
- return e.selectionStart != e.selectionEnd
4276
- } catch (t) {
4277
- return !1
4278
- }
4279
- }
4280
- : function(e) {
4281
- try {
4282
- var t = e.ownerDocument.selection.createRange()
4283
- } catch (n) {}
4284
- return !t || t.parentElement() != e?!1 : t.compareEndPoints("StartToEnd", t) != 0
4285
- }, Ts = function() {
4286
- var e = cs("div");
4287
- return "oncopy"in e?!0 : (e.setAttribute("oncopy", "return;"), typeof e.oncopy == "function")
4288
- }(), Ns = {
4289
- 3: "Enter",
4290
- 8: "Backspace",
4291
- 9: "Tab",
4292
- 13: "Enter",
4293
- 16: "Shift",
4294
- 17: "Ctrl",
4295
- 18: "Alt",
4296
- 19: "Pause",
4297
- 20: "CapsLock",
4298
- 27: "Esc",
4299
- 32: "Space",
4300
- 33: "PageUp",
4301
- 34: "PageDown",
4302
- 35: "End",
4303
- 36: "Home",
4304
- 37: "Left",
4305
- 38: "Up",
4306
- 39: "Right",
4307
- 40: "Down",
4308
- 44: "PrintScrn",
4309
- 45: "Insert",
4310
- 46: "Delete",
4311
- 59: ";",
4312
- 91: "Mod",
4313
- 92: "Mod",
4314
- 93: "Mod",
4315
- 109: "-",
4316
- 107: "=",
4317
- 127: "Delete",
4318
- 186: ";",
4319
- 187: "=",
4320
- 188: ",",
4321
- 189: "-",
4322
- 190: ".",
4323
- 191: "/",
4324
- 192: "`",
4325
- 219: "[",
4326
- 220: "\\",
4327
- 221: "]",
4328
- 222: "'",
4329
- 63276: "PageUp",
4330
- 63277: "PageDown",
4331
- 63275: "End",
4332
- 63273: "Home",
4333
- 63234: "Left",
4334
- 63232: "Up",
4335
- 63235: "Right",
4336
- 63233: "Down",
4337
- 63302: "Insert",
4338
- 63272: "Delete"
4339
- };
4340
- x.keyNames = Ns, function() {
4341
- for (var e = 0; e < 10; e++)
4342
- Ns[e + 48] = String(e);
4343
- for (var e = 65; e <= 90; e++)
4344
- Ns[e] = String.fromCharCode(e);
4345
- for (var e = 1; e <= 12; e++)
4346
- Ns[e + 111] = Ns[e + 63235] = "F" + e
4347
- }();
4348
- var Ps, Is = function() {
4349
- function n(n) {
4350
- return n <= 255 ? e.charAt(n) : 1424 <= n && n <= 1524 ? "R" : 1536 <= n && n <= 1791 ? t.charAt(n-1536) : 1792 <= n && n <= 2220 ? "r" : "L"
4351
- }
4352
- var e = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL", t = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr", r = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/, i = /[stwN]/, s = /[LRr]/, o = /[Lb1n]/, u = /[1n]/, a = "L";
4353
- return function(e) {
4354
- if (!r.test(e))
4355
- return !1;
4356
- var t = e.length, f = [];
4357
- for (var l = 0, c; l < t; ++l)
4358
- f.push(c = n(e.charCodeAt(l)));
4359
- for (var l = 0, h = a; l < t; ++l) {
4360
- var c = f[l];
4361
- c == "m" ? f[l] = h : h = c
4362
- }
4363
- for (var l = 0, p = a; l < t; ++l) {
4364
- var c = f[l];
4365
- c == "1" && p == "r" ? f[l] = "n" : s.test(c) && (p = c, c == "r" && (f[l] = "R"))
4366
- }
4367
- for (var l = 1, h = f[0]; l < t-1; ++l) {
4368
- var c = f[l];
4369
- c == "+" && h == "1" && f[l + 1] == "1" ? f[l] = "1" : c == "," && h == f[l + 1] && (h == "1" || h == "n") && (f[l] = h), h = c
4370
- }
4371
- for (var l = 0; l < t; ++l) {
4372
- var c = f[l];
4373
- if (c == ",")
4374
- f[l] = "N";
4375
- else if (c == "%") {
4376
- for (var d = l + 1; d < t && f[d] == "%"; ++d);
4377
- var v = l && f[l-1] == "!" || d < t-1 && f[d] == "1" ? "1" : "N";
4378
- for (var m = l; m < d; ++m)
4379
- f[m] = v;
4380
- l = d-1
4381
- }
4382
- }
4383
- for (var l = 0, p = a; l < t; ++l) {
4384
- var c = f[l];
4385
- p == "L" && c == "1" ? f[l] = "L" : s.test(c) && (p = c)
4386
- }
4387
- for (var l = 0; l < t; ++l)
4388
- if (i.test(f[l])) {
4389
- for (var d = l + 1; d < t && i.test(f[d]); ++d);
4390
- var g = (l ? f[l-1] : a) == "L", y = (d < t-1 ? f[d] : a) == "L", v = g || y ? "L": "R";
4391
- for (var m = l; m < d; ++m)
4392
- f[m] = v;
4393
- l = d-1
4394
- }
4395
- var b = [], w;
4396
- for (var l = 0; l < t;)
4397
- if (o.test(f[l])) {
4398
- var E = l;
4399
- for (++l; l < t && o.test(f[l]); ++l);
4400
- b.push({
4401
- from: E,
4402
- to: l,
4403
- level: 0
4404
- })
4405
- } else {
4406
- var S = l, x = b.length;
4407
- for (++l; l < t && f[l] != "L"; ++l);
4408
- for (var m = S; m < l;)
4409
- if (u.test(f[m])) {
4410
- S < m && b.splice(x, 0, {
4411
- from: S,
4412
- to: m,
4413
- level: 1
4414
- });
4415
- var T = m;
4416
- for (++m; m < l && u.test(f[m]); ++m);
4417
- b.splice(x, 0, {
4418
- from: T,
4419
- to: m,
4420
- level: 2
4421
- }), S = m
4422
- } else
4423
- ++m;
4424
- S < l && b.splice(x, 0, {
4425
- from: S,
4426
- to: l,
4427
- level: 1
4428
- })
4429
- }
4430
- return b[0].level == 1 && (w = e.match(/^\s+/)) && (b[0].from = w[0].length, b.unshift({
4431
- from : 0, to : w[0].length, level : 0
4432
- })), es(b).level == 1 && (w = e.match(/\s+$/)) && (es(b).to -= w[0].length, b.push({
4433
- from : t - w[0].length, to : t, level : 0
4434
- })), b[0].level != es(b).level && b.push({
4435
- from: t,
4436
- to: t,
4437
- level: b[0].level
4438
- }), b
4439
- }
4440
- }();
4441
- return x.version = "3.20.0", x
4442
- }();