glebtv-ckeditor 4.0.2.7 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (281) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +5 -195
  3. data/{vendor → app}/assets/javascripts/ckeditor/CHANGES.md +56 -0
  4. data/{vendor → app}/assets/javascripts/ckeditor/LICENSE.md +0 -0
  5. data/{vendor → app}/assets/javascripts/ckeditor/README.md +0 -0
  6. data/{vendor → app}/assets/javascripts/ckeditor/build-config.js +0 -0
  7. data/app/assets/javascripts/ckeditor/ckeditor.js +881 -0
  8. data/{vendor → app}/assets/javascripts/ckeditor/config.js.erb +0 -0
  9. data/app/assets/javascripts/ckeditor/contents.css +103 -0
  10. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/gal_add.jpg +0 -0
  11. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/gal_add.png +0 -0
  12. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/gal_del.png +0 -0
  13. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/gal_more.gif +0 -0
  14. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/preloader.gif +0 -0
  15. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/avi.gif +0 -0
  16. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/ckfnothumb.gif +0 -0
  17. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/doc.gif +0 -0
  18. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/docx.gif +0 -0
  19. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/exe.gif +0 -0
  20. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/gz.gif +0 -0
  21. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/htm.gif +0 -0
  22. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/jpg.gif +0 -0
  23. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/mp3.gif +0 -0
  24. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/mpg.gif +0 -0
  25. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/pdf.gif +0 -0
  26. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/psd.gif +0 -0
  27. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/rar.gif +0 -0
  28. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/swf.gif +0 -0
  29. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/tar.gif +0 -0
  30. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/txt.gif +0 -0
  31. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/unknown.gif +0 -0
  32. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/wmv.gif +0 -0
  33. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/xls.gif +0 -0
  34. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/xlsx.gif +0 -0
  35. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/images/thumbs/zip.gif +0 -0
  36. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/javascripts/application.js +0 -0
  37. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.js +0 -0
  38. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.min.js +0 -0
  39. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.tmpl.min.js +0 -0
  40. data/{vendor → app}/assets/javascripts/ckeditor/filebrowser/javascripts/rails.js +0 -0
  41. data/app/assets/javascripts/ckeditor/filebrowser/stylesheets/uploader.css +118 -0
  42. data/app/assets/javascripts/ckeditor/{init.js → init.js.erb} +1 -1
  43. data/{vendor → app}/assets/javascripts/ckeditor/lang/en.js +1 -1
  44. data/{vendor → app}/assets/javascripts/ckeditor/lang/ru.js +1 -1
  45. data/{vendor → app}/assets/javascripts/ckeditor/plugins/CKCss/ckcss.png +0 -0
  46. data/{vendor → app}/assets/javascripts/ckeditor/plugins/CKCss/css/styles.css +0 -0
  47. data/{vendor → app}/assets/javascripts/ckeditor/plugins/CKCss/dialogs/ckcss.js +0 -0
  48. data/{vendor → app}/assets/javascripts/ckeditor/plugins/CKCss/lang/en.js +0 -0
  49. data/{vendor → app}/assets/javascripts/ckeditor/plugins/CKCss/lang/ru.js +0 -0
  50. data/{vendor → app}/assets/javascripts/ckeditor/plugins/CKCss/plugin.js +0 -0
  51. data/{vendor → app}/assets/javascripts/ckeditor/plugins/LoremIpsum/images/icon.png +0 -0
  52. data/{vendor → app}/assets/javascripts/ckeditor/plugins/LoremIpsum/images/icon1.png +0 -0
  53. data/{vendor → app}/assets/javascripts/ckeditor/plugins/LoremIpsum/plugin.js +0 -0
  54. data/{vendor → app}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +0 -0
  55. data/{vendor → app}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +0 -0
  56. data/{vendor → app}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +0 -0
  57. data/{vendor → app}/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +0 -0
  58. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.ckeditor.css +38 -0
  59. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.css +246 -245
  60. data/app/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -0
  61. data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/AutoComplete.png +0 -0
  62. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/icons/AutoFormat.png +0 -0
  63. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/icons/CommentSelectedRange.png +0 -0
  64. data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/SearchCode.png +0 -0
  65. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/icons/UncommentSelectedRange.png +0 -0
  66. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/js/addon/dialog/dialog.js +81 -76
  67. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closebrackets.js +52 -0
  68. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closetag.js +1 -2
  69. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuecomment.js +44 -0
  70. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js +25 -0
  71. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/matchbrackets.js +0 -0
  72. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/brace-fold.js +31 -0
  73. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/foldcode.js +32 -0
  74. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/addon/fold/xml-fold.js +64 -0
  75. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/autoFormatAll.js +0 -0
  76. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/js/addon/format/formatting.js +0 -0
  77. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/match-highlighter.js +0 -0
  78. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/search.js +131 -131
  79. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/js/addon/search/searchcursor.js +8 -9
  80. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +1 -0
  81. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.js +264 -132
  82. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +1 -0
  83. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.modes.min.js +1 -0
  84. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.search-addons.min.js +1 -0
  85. data/{vendor/assets/javascripts/ckeditor/plugins/codemirror/js → app/assets/javascripts/ckeditor/plugins/codemirror/js/mode}/css.js +337 -235
  86. data/{vendor/assets/javascripts/ckeditor/plugins/codemirror/js → app/assets/javascripts/ckeditor/plugins/codemirror/js/mode}/htmlmixed.js +0 -0
  87. data/{vendor/assets/javascripts/ckeditor/plugins/codemirror/js → app/assets/javascripts/ckeditor/plugins/codemirror/js/mode}/javascript.js +17 -6
  88. data/{vendor/assets/javascripts/ckeditor/plugins/codemirror/js → app/assets/javascripts/ckeditor/plugins/codemirror/js/mode}/xml.js +9 -5
  89. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/lang/en.js +4 -2
  90. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/lang/ru.js +0 -0
  91. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +146 -34
  92. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance-mobile.css +0 -1
  93. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance.css +0 -1
  94. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/blackboard.css +0 -0
  95. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/cobalt.css +0 -0
  96. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/eclipse.css +1 -1
  97. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/elegant.css +0 -0
  98. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/erlang-dark.css +5 -5
  99. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +0 -0
  100. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +0 -0
  101. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/neat.css +0 -0
  102. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/night.css +0 -0
  103. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/rubyblue.css +0 -0
  104. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +0 -0
  105. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/twilight.css +0 -0
  106. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +0 -0
  107. data/{vendor → app}/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-dark.css +0 -0
  108. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-light.css +43 -0
  109. data/{vendor → app}/assets/javascripts/ckeditor/plugins/colorbutton/icons/bgcolor.png +0 -0
  110. data/{vendor → app}/assets/javascripts/ckeditor/plugins/colorbutton/icons/textcolor.png +0 -0
  111. data/{vendor → app}/assets/javascripts/ckeditor/plugins/colorbutton/lang/en.js +0 -0
  112. data/{vendor → app}/assets/javascripts/ckeditor/plugins/colorbutton/lang/ru.js +0 -0
  113. data/{vendor → app}/assets/javascripts/ckeditor/plugins/colorbutton/plugin.js +6 -2
  114. data/{vendor → app}/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +0 -0
  115. data/{vendor → app}/assets/javascripts/ckeditor/plugins/colordialog/lang/en.js +0 -0
  116. data/{vendor → app}/assets/javascripts/ckeditor/plugins/colordialog/lang/ru.js +0 -0
  117. data/{vendor → app}/assets/javascripts/ckeditor/plugins/colordialog/plugin.js +1 -1
  118. data/{vendor → app}/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +0 -0
  119. data/{vendor → app}/assets/javascripts/ckeditor/plugins/fakeobjects/images/spacer.gif +0 -0
  120. data/{vendor → app}/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +10 -9
  121. data/{vendor → app}/assets/javascripts/ckeditor/plugins/flash/images/placeholder.png +0 -0
  122. data/{vendor → app}/assets/javascripts/ckeditor/plugins/font/lang/en.js +0 -0
  123. data/{vendor → app}/assets/javascripts/ckeditor/plugins/font/lang/ru.js +0 -0
  124. data/{vendor → app}/assets/javascripts/ckeditor/plugins/font/plugin.js +5 -2
  125. data/{vendor → app}/assets/javascripts/ckeditor/plugins/highslide/dialogs/hs.js +0 -0
  126. data/{vendor → app}/assets/javascripts/ckeditor/plugins/highslide/icon.png +0 -0
  127. data/{vendor → app}/assets/javascripts/ckeditor/plugins/highslide/lang/en.js +0 -0
  128. data/{vendor → app}/assets/javascripts/ckeditor/plugins/highslide/lang/ru.js +0 -0
  129. data/{vendor → app}/assets/javascripts/ckeditor/plugins/highslide/plugin.js +0 -0
  130. data/{vendor → app}/assets/javascripts/ckeditor/plugins/highslide/readme.txt +0 -0
  131. data/app/assets/javascripts/ckeditor/plugins/icons.png +0 -0
  132. data/{vendor → app}/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +0 -0
  133. data/app/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +43 -0
  134. data/{vendor → app}/assets/javascripts/ckeditor/plugins/image/images/noimage.png +0 -0
  135. data/{vendor → app}/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +0 -0
  136. data/{vendor → app}/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +15 -15
  137. data/{vendor → app}/assets/javascripts/ckeditor/plugins/link/images/anchor.png +0 -0
  138. data/{vendor → app}/assets/javascripts/ckeditor/plugins/magicline/images/icon.png +0 -0
  139. data/{vendor → app}/assets/javascripts/ckeditor/plugins/mediaembed/images/icon.png +0 -0
  140. data/{vendor → app}/assets/javascripts/ckeditor/plugins/oembed/images/icon.png +0 -0
  141. data/app/assets/javascripts/ckeditor/plugins/oembed/libs/jquery.oembed.js +68 -0
  142. data/app/assets/javascripts/ckeditor/plugins/oembed/libs/jquery.oembed.min.js +68 -0
  143. data/{vendor → app}/assets/javascripts/ckeditor/plugins/panelbutton/plugin.js +0 -0
  144. data/app/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +31 -0
  145. data/{vendor → app}/assets/javascripts/ckeditor/plugins/scayt/LICENSE.md +0 -0
  146. data/{vendor → app}/assets/javascripts/ckeditor/plugins/scayt/README.md +0 -0
  147. data/{vendor → app}/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +0 -0
  148. data/{vendor → app}/assets/javascripts/ckeditor/plugins/scayt/dialogs/toolbar.css +0 -0
  149. data/{vendor → app}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +0 -0
  150. data/{vendor → app}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +0 -0
  151. data/app/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +21 -0
  152. data/{vendor → app}/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +0 -0
  153. data/{vendor → app}/assets/javascripts/ckeditor/plugins/wsc/LICENSE.md +0 -0
  154. data/{vendor → app}/assets/javascripts/ckeditor/plugins/wsc/README.md +0 -0
  155. data/{vendor → app}/assets/javascripts/ckeditor/plugins/wsc/dialogs/ciframe.html +0 -0
  156. data/{vendor → app}/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +0 -0
  157. data/{vendor → app}/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.css +0 -0
  158. data/{vendor → app}/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +0 -0
  159. data/app/assets/javascripts/ckeditor/samples/ajax.html +82 -0
  160. data/app/assets/javascripts/ckeditor/samples/api.html +207 -0
  161. data/app/assets/javascripts/ckeditor/samples/appendto.html +57 -0
  162. data/app/assets/javascripts/ckeditor/samples/assets/inlineall/logo.png +0 -0
  163. data/app/assets/javascripts/ckeditor/samples/assets/outputxhtml/outputxhtml.css +204 -0
  164. data/app/assets/javascripts/ckeditor/samples/assets/posteddata.php +59 -0
  165. data/app/assets/javascripts/ckeditor/samples/assets/sample.css +3 -0
  166. data/app/assets/javascripts/ckeditor/samples/assets/sample.jpg +0 -0
  167. data/app/assets/javascripts/ckeditor/samples/assets/uilanguages/languages.js +7 -0
  168. data/app/assets/javascripts/ckeditor/samples/datafiltering.html +401 -0
  169. data/app/assets/javascripts/ckeditor/samples/divreplace.html +141 -0
  170. data/app/assets/javascripts/ckeditor/samples/index.html +125 -0
  171. data/app/assets/javascripts/ckeditor/samples/inlineall.html +311 -0
  172. data/app/assets/javascripts/ckeditor/samples/inlinebycode.html +122 -0
  173. data/app/assets/javascripts/ckeditor/samples/plugins/dialog/assets/my_dialog.js +48 -0
  174. data/app/assets/javascripts/ckeditor/samples/plugins/dialog/dialog.html +187 -0
  175. data/app/assets/javascripts/ckeditor/samples/plugins/enterkey/enterkey.html +103 -0
  176. data/app/assets/javascripts/ckeditor/samples/plugins/htmlwriter/assets/outputforflash/outputforflash.fla +0 -0
  177. data/app/assets/javascripts/ckeditor/samples/plugins/htmlwriter/assets/outputforflash/outputforflash.swf +0 -0
  178. data/app/assets/javascripts/ckeditor/samples/plugins/htmlwriter/assets/outputforflash/swfobject.js +18 -0
  179. data/app/assets/javascripts/ckeditor/samples/plugins/htmlwriter/outputforflash.html +280 -0
  180. data/app/assets/javascripts/ckeditor/samples/plugins/htmlwriter/outputhtml.html +221 -0
  181. data/app/assets/javascripts/ckeditor/samples/plugins/magicline/magicline.html +207 -0
  182. data/{vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/samples → app/assets/javascripts/ckeditor/samples/plugins/stylesheetparser}/assets/sample.css +70 -70
  183. data/{vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/samples → app/assets/javascripts/ckeditor/samples/plugins/stylesheetparser}/stylesheetparser.html +82 -82
  184. data/app/assets/javascripts/ckeditor/samples/plugins/toolbar/toolbar.html +232 -0
  185. data/app/assets/javascripts/ckeditor/samples/plugins/wysiwygarea/fullpage.html +77 -0
  186. data/app/assets/javascripts/ckeditor/samples/readonly.html +73 -0
  187. data/app/assets/javascripts/ckeditor/samples/replacebyclass.html +57 -0
  188. data/app/assets/javascripts/ckeditor/samples/replacebycode.html +56 -0
  189. data/app/assets/javascripts/ckeditor/samples/sample.css +339 -0
  190. data/app/assets/javascripts/ckeditor/samples/sample.js +33 -0
  191. data/app/assets/javascripts/ckeditor/samples/sample_posteddata.php +16 -0
  192. data/app/assets/javascripts/ckeditor/samples/tabindex.html +75 -0
  193. data/app/assets/javascripts/ckeditor/samples/uicolor.html +69 -0
  194. data/app/assets/javascripts/ckeditor/samples/uilanguages.html +119 -0
  195. data/app/assets/javascripts/ckeditor/samples/xhtmlstyle.html +231 -0
  196. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/dialog.css +0 -0
  197. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +0 -0
  198. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +0 -0
  199. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +0 -0
  200. data/app/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +5 -0
  201. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/dialog_opera.css +0 -0
  202. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/editor.css +1 -1
  203. data/{vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css → app/assets/javascripts/ckeditor/skins/moono/editor_gecko.css} +1 -1
  204. data/{vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css → app/assets/javascripts/ckeditor/skins/moono/editor_ie.css} +1 -1
  205. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +1 -1
  206. data/app/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +5 -0
  207. data/{vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css → app/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css} +1 -1
  208. data/app/assets/javascripts/ckeditor/skins/moono/icons.png +0 -0
  209. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/images/arrow.png +0 -0
  210. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/images/close.png +0 -0
  211. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/images/mini.png +0 -0
  212. data/{vendor → app}/assets/javascripts/ckeditor/skins/moono/readme.md +0 -0
  213. data/{vendor → app}/assets/javascripts/ckeditor/styles.js +1 -2
  214. data/app/controllers/ckeditor/application_controller.rb +6 -12
  215. data/app/controllers/ckeditor/attachment_files_controller.rb +6 -2
  216. data/app/controllers/ckeditor/pictures_controller.rb +6 -2
  217. data/app/views/ckeditor/shared/_asset.html.erb +4 -4
  218. data/app/views/ckeditor/shared/_asset_tmpl.html.erb +1 -1
  219. data/lib/ckeditor.rb +91 -19
  220. data/lib/ckeditor/engine.rb +5 -8
  221. data/lib/ckeditor/helpers/controllers.rb +7 -3
  222. data/lib/ckeditor/helpers/form_builder.rb +1 -1
  223. data/lib/ckeditor/helpers/form_helper.rb +12 -15
  224. data/lib/ckeditor/helpers/view_helper.rb +1 -1
  225. data/lib/ckeditor/hooks/cancan.rb +46 -0
  226. data/lib/ckeditor/hooks/simple_form.rb +11 -0
  227. data/lib/ckeditor/orm/active_record.rb +1 -3
  228. data/lib/ckeditor/orm/base.rb +4 -0
  229. data/lib/ckeditor/orm/mongoid.rb +1 -3
  230. data/lib/ckeditor/utils.rb +25 -8
  231. data/lib/ckeditor/version.rb +2 -2
  232. data/lib/generators/ckeditor/install_generator.rb +2 -2
  233. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/asset.rb +2 -2
  234. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb +4 -4
  235. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb +4 -4
  236. data/lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb +1 -1
  237. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/attachment_file.rb +4 -4
  238. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb +8 -8
  239. data/lib/generators/ckeditor/templates/active_record/paperclip/migration.rb +6 -6
  240. data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb +1 -7
  241. data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_picture_uploader.rb +1 -7
  242. data/lib/generators/ckeditor/templates/base/dragonfly/initializer.rb +3 -3
  243. data/lib/generators/ckeditor/templates/ckeditor.rb +3 -0
  244. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb +1 -1
  245. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/attachment_file.rb +4 -4
  246. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb +4 -4
  247. data/test/dummy/app/views/posts/_form.html.erb +3 -3
  248. data/test/dummy/script/rails +0 -0
  249. data/test/functional/posts_controller_test.rb +3 -3
  250. metadata +346 -321
  251. data/vendor/assets/javascripts/ckeditor/ckeditor.js +0 -830
  252. data/vendor/assets/javascripts/ckeditor/filebrowser/stylesheets/uploader.css.sass +0 -102
  253. data/vendor/assets/javascripts/ckeditor/plugins/code/code/code.js +0 -48
  254. data/vendor/assets/javascripts/ckeditor/plugins/code/images/code.png +0 -0
  255. data/vendor/assets/javascripts/ckeditor/plugins/code/plugin.js +0 -17
  256. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +0 -1
  257. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/closebrackets.js +0 -29
  258. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js +0 -28
  259. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/foldcode/foldcode.js +0 -183
  260. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +0 -1
  261. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +0 -1
  262. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.modes.min.js +0 -1
  263. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.search-addons.min.js +0 -1
  264. data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
  265. data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +0 -41
  266. data/vendor/assets/javascripts/ckeditor/plugins/mediaembed/plugin.js +0 -67
  267. data/vendor/assets/javascripts/ckeditor/plugins/oembed/lang/de.js +0 -12
  268. data/vendor/assets/javascripts/ckeditor/plugins/oembed/lang/en.js +0 -12
  269. data/vendor/assets/javascripts/ckeditor/plugins/oembed/lang/fr.js +0 -14
  270. data/vendor/assets/javascripts/ckeditor/plugins/oembed/lang/nl.js +0 -12
  271. data/vendor/assets/javascripts/ckeditor/plugins/oembed/lang/ru.js +0 -12
  272. data/vendor/assets/javascripts/ckeditor/plugins/oembed/libs/jquery.oembed.js +0 -912
  273. data/vendor/assets/javascripts/ckeditor/plugins/oembed/libs/jquery.oembed.min.js +0 -1
  274. data/vendor/assets/javascripts/ckeditor/plugins/oembed/plugin.js +0 -102
  275. data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +0 -31
  276. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +0 -13
  277. data/vendor/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +0 -138
  278. data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +0 -20
  279. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +0 -689
  280. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +0 -1245
  281. data/vendor/assets/javascripts/ckeditor/skins/moono/icons.png +0 -0
@@ -1,102 +0,0 @@
1
- body
2
- padding: 0
3
- margin: 0
4
- font-family: Arial, Helvetica, sans-serif
5
-
6
- img
7
- border: 0
8
-
9
- .gal-holder
10
- display: block
11
- overflow: hidden
12
- padding: 20px
13
- .gal-item
14
- display: block
15
- float: left
16
- width: 150px
17
- overflow: hidden
18
- position: relative
19
- margin: 0 12px 12px 0
20
- .gal-del
21
- display: block
22
- position: absolute
23
- right: 0
24
- top: 0
25
- &:hover
26
- -moz-opacity: 0.7
27
- -khtml-opacity: 0.7
28
- opacity: 0.7
29
- .gal-upload-holder
30
- input
31
- height: 162px
32
- .add:hover
33
- text-decoration: underline
34
- .gal-inner-holder, .gal-upload-holder
35
- display: block
36
- margin: 6px 6px 0 0
37
- overflow: hidden
38
- padding: 12px
39
- background: #fff
40
- border: solid 1px #D3D3D3
41
- min-height: 138px
42
- .gal-inner-holder
43
- &.hover
44
- background: #DFF1FF
45
- border: solid 1px #99CCFF
46
- &.selected
47
- background: #B4D9FF
48
- border: solid 1px #6565FE
49
- .gal-upload-holder .add
50
- display: block
51
- color: #2e5aff
52
- background: image-url('ckeditor/filebrowser/images/gal_add.png') no-repeat left center
53
- padding-left: 33px
54
- line-height: 25px
55
- text-decoration: none
56
- margin: 50px 0 0 10px
57
- font-size: 14px
58
- .gal-inner-holder
59
- .img
60
- height: 100px
61
- overflow: hidden
62
- cursor: pointer
63
- &.preloader
64
- padding: 27px 0 0 33px
65
- height: 73px
66
- .img-data
67
- display: block
68
- overflow: hidden
69
- padding-top: 5px
70
- .img-name
71
- display: block
72
- color: #333
73
- padding-bottom: 5px
74
- font-size: 12px
75
- overflow: hidden
76
- width: 500px
77
- .time-size
78
- display: block
79
- overflow: hidden
80
- font-size: 10px
81
- color: #666
82
- .time
83
- display: block
84
- float: left
85
- .size
86
- display: block
87
- float: right
88
-
89
- .gal-more
90
- display: block
91
- overflow: hidden
92
- border-top: dashed 1px #d3d3d3
93
- padding: 20px 0
94
- text-align: center
95
- a
96
- color: #2e5aff
97
- background: image-url('ckeditor/filebrowser/images/gal_more.gif') no-repeat left center
98
- padding-left: 15px
99
- font-size: 14px
100
- text-decoration: none
101
- &:hover
102
- text-decoration: underline
@@ -1,48 +0,0 @@
1
- CKEDITOR.dialog.add('code', function (editor) {
2
- return {
3
- title: 'Code',
4
- minWidth: 400,
5
- minHeight: 200,
6
- contents: [{
7
- id: 'tab1',
8
- label: 'First Tab',
9
- title: 'First Tab',
10
- elements: [{
11
- type: 'html',
12
- id: 'content',
13
- html: '<select size="1" name="chili">' +
14
- '<option value="ruby">Ruby</option>' +
15
- '<option value="haml">HAML</option>' +
16
- '<option value="python">Python</option>' +
17
- '<option value="yaml">YAML</option>' +
18
- '<option value="html">HTML</option>' +
19
- '<option value="php">PHP</option>' +
20
- '<option value="sql">SQL</option>' +
21
- '<option value="js">JavaScript</option>' +
22
- '<option value="java">Java</option>' +
23
- '<option value="css">CSS</option>' +
24
- '</select>',
25
- validate: function () {
26
- CKEDITOR.config.chili_val = this.getValue();
27
- }
28
- }, {
29
- id: 'input1',
30
- type: 'textarea',
31
- label: 'Вставьте код:',
32
- validate: function () {
33
- if (!this.getValue()) {
34
- alert('Empty Field');
35
- return false;
36
- }
37
- var element = editor.document.createElement('pre');
38
- element.setAttribute('class', 'code');
39
- element.setAttribute('lang', CKEDITOR.config.chili_val);
40
- element.setText(this.getValue());
41
- editor.insertElement(element);
42
- CKEDITOR.ENTER_BR;
43
- return true;
44
- }
45
- }]
46
- }]
47
- };
48
- });
@@ -1,17 +0,0 @@
1
- (function () {
2
- var pluginName = 'code';
3
- // Регистрируем имя плагина .
4
- CKEDITOR.plugins.add(pluginName, {
5
- init: function (editor) { //Добавляем команду на нажатие кнопки
6
- editor.addCommand(pluginName, new CKEDITOR.dialogCommand('code'));
7
- //Указываем где скрипт окна диалога.
8
- CKEDITOR.dialog.add(pluginName, this.path + 'code/code.js');
9
- // Добавляем кнопочку
10
- editor.ui.addButton('Code', {
11
- label: 'Code', //Title кнопки
12
- command: pluginName,
13
- icon: this.path + 'images/code.png' //Путь к иконке
14
- });
15
- }
16
- });
17
- })();
@@ -1 +0,0 @@
1
- .CodeMirror{font-family:monospace;height:300px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7}.CodeMirror-linenumbers{}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #000}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:transparent;background:rgba(0,200,0,.4);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800,endColorstr=#4c00c800)}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor:not(#nonsense_id){filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite{}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:#000}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:#000}.cm-s-default .cm-operator{color:#000}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-emstrong{font-style:italic;font-weight:bold}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror{line-height:1;position:relative;overflow:hidden}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:none;position:relative}.CodeMirror-sizer{position:relative}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0;z-index:6}.CodeMirror-gutters{position:absolute;left:0;top:0;height:100%;padding-bottom:30px;z-index:3}.CodeMirror-gutter{height:100%;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;-o-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-widget{display:inline-block}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:none;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}}.CodeMirror{font:13px/1.4em monospace}.CodeMirror .activeline{background:#e8f2ff}.CodeMirror .CodeMirror-foldmarker{color:blue;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.cm-s-cobalt .CodeMirror-selected{background:#b36539!important}.cm-s-erlang-dark .CodeMirror-selected{background:#b36539!important}.cm-s-lesser-dark .CodeMirror-selected{background:#45443b!important}.cm-s-monokai .CodeMirror-selected{background:#49483e!important}.cm-s-night .CodeMirror-selected{background:#447!important}.cm-s-rubyblue .CodeMirror-selected{background:#38566f!important}.cm-s-twilight .CodeMirror-selected{background:#323232!important}.cm-s-xq-dark .CodeMirror-selected{background:#a8f!important}.cm-s-blackboard .activeline,.cm-s-cobalt .activeline,.cm-s-erlang-dark .activeline,.cm-s-lesser-dark .activeline,.cm-s-monokai .activeline,.cm-s-night .activeline,.cm-s-rubyblue .activeline,.cm-s-vibrant-ink .activeline,.cm-s-xq-dark .activeline{background:#757575}.cm-s-twilight .activeline{background:#494949}.CodeMirror-focused .cm-matchhighlight{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==);background-position:bottom;background-repeat:repeat-x}.CodeMirror-dialog{position:absolute;left:0;right:0;background:#fff;z-index:15;padding:.1em .8em;overflow:hidden;color:#333}.CodeMirror-dialog-top{border-bottom:1px solid #eee;top:0}.CodeMirror-dialog-bottom{border-top:1px solid #eee;bottom:0}.CodeMirror-dialog input{border:none;outline:none;background:transparent;width:20em;color:inherit;font-family:monospace}.CodeMirror-dialog button{font-size:70%}
@@ -1,29 +0,0 @@
1
- (function() {
2
- var DEFAULT_BRACKETS = "()[]{}''\"\"";
3
-
4
- CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
5
- var wasOn = old && old != CodeMirror.Init;
6
- if (val && !wasOn)
7
- cm.addKeyMap(buildKeymap(typeof val == "string" ? val : DEFAULT_BRACKETS));
8
- else if (!val && wasOn)
9
- cm.removeKeyMap("autoCloseBrackets");
10
- });
11
-
12
- function buildKeymap(pairs) {
13
- var map = {name : "autoCloseBrackets"};
14
- for (var i = 0; i < pairs.length; i += 2) (function(left, right) {
15
- function maybeOverwrite(cm) {
16
- var cur = cm.getCursor(), ahead = cm.getRange(cur, CodeMirror.Pos(cur.line, cur.ch + 1));
17
- if (ahead != right) return CodeMirror.Pass;
18
- else cm.execCommand("goCharRight");
19
- }
20
- map["'" + left + "'"] = function(cm) {
21
- if (left == right && maybeOverwrite(cm) != CodeMirror.Pass) return;
22
- var cur = cm.getCursor("start"), ahead = CodeMirror.Pos(cur.line, cur.ch + 1);
23
- cm.replaceSelection(left + right, {head: ahead, anchor: ahead});
24
- };
25
- if (left != right) map["'" + right + "'"] = maybeOverwrite;
26
- })(pairs.charAt(i), pairs.charAt(i + 1));
27
- return map;
28
- }
29
- })();
@@ -1,28 +0,0 @@
1
- (function() {
2
- CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
3
- var pos = cm.getCursor(), token = cm.getTokenAt(pos);
4
- var space;
5
- if (token.className == "string") {
6
- var full = cm.getRange({line: pos.line, ch: 0}, {line: pos.line, ch: token.end});
7
- var listStart = /\*|\d+\./, listContinue;
8
- if (token.string.search(listStart) == 0) {
9
- var reg = /^[\W]*(\d+)\./g;
10
- var matches = reg.exec(full);
11
- if(matches)
12
- listContinue = (parseInt(matches[1]) + 1) + ". ";
13
- else
14
- listContinue = "* ";
15
- space = full.slice(0, token.start);
16
- if (!/^\s*$/.test(space)) {
17
- space = "";
18
- for (var i = 0; i < token.start; ++i) space += " ";
19
- }
20
- }
21
- }
22
-
23
- if (space != null)
24
- cm.replaceSelection("\n" + space + listContinue, "end");
25
- else
26
- cm.execCommand("newlineAndIndent");
27
- };
28
- })();
@@ -1,183 +0,0 @@
1
- // the tagRangeFinder function is
2
- // Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org>
3
- // released under the MIT license (../../LICENSE) like the rest of CodeMirror
4
- CodeMirror.tagRangeFinder = function(cm, start) {
5
- var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
6
- var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
7
- var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*");
8
-
9
- var lineText = cm.getLine(start.line);
10
- var found = false;
11
- var tag = null;
12
- var pos = start.ch;
13
- while (!found) {
14
- pos = lineText.indexOf("<", pos);
15
- if (-1 == pos) // no tag on line
16
- return;
17
- if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag
18
- pos++;
19
- continue;
20
- }
21
- // ok we seem to have a start tag
22
- if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name...
23
- pos++;
24
- continue;
25
- }
26
- var gtPos = lineText.indexOf(">", pos + 1);
27
- if (-1 == gtPos) { // end of start tag not in line
28
- var l = start.line + 1;
29
- var foundGt = false;
30
- var lastLine = cm.lineCount();
31
- while (l < lastLine && !foundGt) {
32
- var lt = cm.getLine(l);
33
- gtPos = lt.indexOf(">");
34
- if (-1 != gtPos) { // found a >
35
- foundGt = true;
36
- var slash = lt.lastIndexOf("/", gtPos);
37
- if (-1 != slash && slash < gtPos) {
38
- var str = lineText.substr(slash, gtPos - slash + 1);
39
- if (!str.match( /\/\s*\>/ )) // yep, that's the end of empty tag
40
- return;
41
- }
42
- }
43
- l++;
44
- }
45
- found = true;
46
- }
47
- else {
48
- var slashPos = lineText.lastIndexOf("/", gtPos);
49
- if (-1 == slashPos) { // cannot be empty tag
50
- found = true;
51
- // don't continue
52
- }
53
- else { // empty tag?
54
- // check if really empty tag
55
- var str = lineText.substr(slashPos, gtPos - slashPos + 1);
56
- if (!str.match( /\/\s*\>/ )) { // finally not empty
57
- found = true;
58
- // don't continue
59
- }
60
- }
61
- }
62
- if (found) {
63
- var subLine = lineText.substr(pos + 1);
64
- tag = subLine.match(xmlNAMERegExp);
65
- if (tag) {
66
- // we have an element name, wooohooo !
67
- tag = tag[0];
68
- // do we have the close tag on same line ???
69
- if (-1 != lineText.indexOf("</" + tag + ">", pos)) // yep
70
- {
71
- found = false;
72
- }
73
- // we don't, so we have a candidate...
74
- }
75
- else
76
- found = false;
77
- }
78
- if (!found)
79
- pos++;
80
- }
81
-
82
- if (found) {
83
- var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)";
84
- var startTagRegExp = new RegExp(startTag);
85
- var endTag = "</" + tag + ">";
86
- var depth = 1;
87
- var l = start.line + 1;
88
- var lastLine = cm.lineCount();
89
- while (l < lastLine) {
90
- lineText = cm.getLine(l);
91
- var match = lineText.match(startTagRegExp);
92
- if (match) {
93
- for (var i = 0; i < match.length; i++) {
94
- if (match[i] == endTag)
95
- depth--;
96
- else
97
- depth++;
98
- if (!depth) return {from: CodeMirror.Pos(start.line, gtPos + 1),
99
- to: CodeMirror.Pos(l, match.index)};
100
- }
101
- }
102
- l++;
103
- }
104
- return;
105
- }
106
- };
107
-
108
- CodeMirror.braceRangeFinder = function(cm, start) {
109
- var line = start.line, lineText = cm.getLine(line);
110
- var at = lineText.length, startChar, tokenType;
111
- for (;;) {
112
- var found = lineText.lastIndexOf("{", at);
113
- if (found < start.ch) break;
114
- tokenType = cm.getTokenAt(CodeMirror.Pos(line, found + 1)).type;
115
- if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; }
116
- at = found - 1;
117
- }
118
- if (startChar == null || lineText.lastIndexOf("}") > startChar) return;
119
- var count = 1, lastLine = cm.lineCount(), end, endCh;
120
- outer: for (var i = line + 1; i < lastLine; ++i) {
121
- var text = cm.getLine(i), pos = 0;
122
- for (;;) {
123
- var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);
124
- if (nextOpen < 0) nextOpen = text.length;
125
- if (nextClose < 0) nextClose = text.length;
126
- pos = Math.min(nextOpen, nextClose);
127
- if (pos == text.length) break;
128
- if (cm.getTokenAt(CodeMirror.Pos(i, pos + 1)).type == tokenType) {
129
- if (pos == nextOpen) ++count;
130
- else if (!--count) { end = i; endCh = pos; break outer; }
131
- }
132
- ++pos;
133
- }
134
- }
135
- if (end == null || end == line + 1) return;
136
- return {from: CodeMirror.Pos(line, startChar + 1),
137
- to: CodeMirror.Pos(end, endCh)};
138
- };
139
-
140
- CodeMirror.indentRangeFinder = function(cm, start) {
141
- var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line);
142
- var myIndent = CodeMirror.countColumn(firstLine, null, tabSize);
143
- for (var i = start.line + 1, end = cm.lineCount(); i < end; ++i) {
144
- var curLine = cm.getLine(i);
145
- if (CodeMirror.countColumn(curLine, null, tabSize) < myIndent &&
146
- CodeMirror.countColumn(cm.getLine(i-1), null, tabSize) > myIndent)
147
- return {from: CodeMirror.Pos(start.line, firstLine.length),
148
- to: CodeMirror.Pos(i, curLine.length)};
149
- }
150
- };
151
-
152
- CodeMirror.newFoldFunction = function(rangeFinder, widget) {
153
- if (widget == null) widget = "\u2194";
154
- if (typeof widget == "string") {
155
- var text = document.createTextNode(widget);
156
- widget = document.createElement("span");
157
- widget.appendChild(text);
158
- widget.className = "CodeMirror-foldmarker";
159
- }
160
-
161
- return function(cm, pos) {
162
- if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
163
- var range = rangeFinder(cm, pos);
164
- if (!range) return;
165
-
166
- var present = cm.findMarksAt(range.from), cleared = 0;
167
- for (var i = 0; i < present.length; ++i) {
168
- if (present[i].__isFold) {
169
- ++cleared;
170
- present[i].clear();
171
- }
172
- }
173
- if (cleared) return;
174
-
175
- var myWidget = widget.cloneNode(true);
176
- CodeMirror.on(myWidget, "mousedown", function() {myRange.clear();});
177
- var myRange = cm.markText(range.from, range.to, {
178
- replacedWith: myWidget,
179
- clearOnEnter: true,
180
- __isFold: true
181
- });
182
- };
183
- };
@@ -1 +0,0 @@
1
- (function(){function t(n){for(var i={name:"autoCloseBrackets"},t=0;t<n.length;t+=2)(function(n,t){function r(n){var i=n.getCursor(),r=n.getRange(i,CodeMirror.Pos(i.line,i.ch+1));if(r!=t)return CodeMirror.Pass;n.execCommand("goCharRight")}i["'"+n+"'"]=function(i){if(n!=t||r(i)==CodeMirror.Pass){var u=i.getCursor("start"),f=CodeMirror.Pos(u.line,u.ch+1);i.replaceSelection(n+t,{head:f,anchor:f})}},n!=t&&(i["'"+t+"'"]=r)})(n.charAt(t),n.charAt(t+1));return i}var n="()[]{}''\"\"";CodeMirror.defineOption("autoCloseBrackets",!1,function(i,r,u){var f=u&&u!=CodeMirror.Init;r&&!f?i.addKeyMap(t(typeof r=="string"?r:n)):!r&&f&&i.removeKeyMap("autoCloseBrackets")})})(),function(){function n(n,u){var e=n.getCursor(),o=n.getTokenAt(e),l=CodeMirror.innerMode(n.getMode(),o.state),s=l.state,a,c,v,f;if(l.mode.name!="xml")return CodeMirror.Pass;var h=n.getOption("autoCloseTags"),y=l.mode.configuration=="html",p=typeof h=="object"&&h.dontCloseTags||y&&i,w=typeof h=="object"&&h.indentTags||y&&r;if(u==">"&&s.tagName){if(f=s.tagName,o.end>e.ch&&(f=f.slice(0,f.length-o.end+e.ch)),a=f.toLowerCase(),o.type=="tag"&&s.type=="closeTag"||/\/\s*$/.test(o.string)||p&&t(p,a)>-1)return CodeMirror.Pass;c=w&&t(w,a)>-1,v=c?CodeMirror.Pos(e.line+1,0):CodeMirror.Pos(e.line,e.ch+1),n.replaceSelection(">"+(c?"\n\n":"")+"<\/"+f+">",{head:v,anchor:v}),c&&(n.indentLine(e.line+1),n.indentLine(e.line+2));return}if(u=="/"&&o.string=="<"){f=s.context&&s.context.tagName,f&&n.replaceSelection("/"+f+">","end");return}return CodeMirror.Pass}function t(n,t){if(n.indexOf)return n.indexOf(t);for(var i=0,r=n.length;i<r;++i)if(n[i]==t)return i;return-1}CodeMirror.defineOption("autoCloseTags",!1,function(t,i,r){if(i&&(r==CodeMirror.Init||!r)){var u={name:"autoCloseTags"};(typeof i!="object"||i.whenClosing)&&(u["'/'"]=function(t){return n(t,"/")}),(typeof i!="object"||i.whenOpening)&&(u["'>'"]=function(t){return n(t,">")}),t.addKeyMap(u)}else!i&&r!=CodeMirror.Init&&r&&t.removeKeyMap("autoCloseTags")});var i=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],r=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"]}(),function(){function u(t){function a(r,u,f){var e,a,s,l;if(r.text)for(e=o?0:r.text.length-1,a=o?r.text.length:-1,f!=null&&(e=f+h);e!=a;e+=h)if(s=r.text.charAt(e),p.test(s)&&t.getTokenAt(n(u,e+1)).type==y)if(l=i[s],l.charAt(1)==">"==o)c.push(s);else{if(c.pop()!=l.charAt(0))return{pos:e,match:!1};if(!c.length)return{pos:e,match:!0}}}var f=t.getCursor(),s=t.getLineHandle(f.line),u=f.ch-1,l=u>=0&&i[s.text.charAt(u)]||i[s.text.charAt(++u)],r,e,v;if(!l)return null;var o=l.charAt(1)==">",h=o?1:-1,y=t.getTokenAt(n(f.line,u+1)).type,c=[s.text.charAt(u)],p=/[(){}[\]]/;for(r=f.line,v=o?Math.min(r+100,t.lineCount()):Math.max(-1,r-100);r!=v;r+=h)if(e=r==f.line?a(s,r,u):a(t.getLineHandle(r),r),e)break;return{from:n(f.line,u),to:e&&n(r,e.pos),match:e&&e.match}}function f(t,i){var f=u(t),e;if(f&&!(t.getLine(f.from.line).length>r)&&(!f.to||!(t.getLine(f.to.line).length>r))){var s=f.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",c=t.markText(f.from,n(f.from.line,f.from.ch+1),{className:s}),h=f.to&&t.markText(f.to,n(f.to.line,f.to.ch+1),{className:s});if(o&&t.state.focused&&t.display.input.focus(),e=function(){t.operation(function(){c.clear(),h&&h.clear()})},i)setTimeout(e,800);else return e}}function e(n){n.operation(function(){t&&(t(),t=null),n.somethingSelected()||(t=f(n,!1))})}var o=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),n=CodeMirror.Pos,r=1e3,i={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},t=null;CodeMirror.defineOption("matchBrackets",!1,function(n,t){if(t)n.on("cursorActivity",e);else n.off("cursorActivity",e)}),CodeMirror.defineExtension("matchBrackets",function(){f(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(){return u(this)})}(),CodeMirror.tagRangeFinder=function(n,t){for(var w="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",g=w+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",b=new RegExp("^["+w+"]["+g+"]*"),i=n.getLine(t.line),e=!1,u=null,r=t.ch,f,y,s,l,h,d,c,a;!e;){if(r=i.indexOf("<",r),-1==r)return;if(r+1<i.length&&i[r+1]=="/"){r++;continue}if(!i.substr(r+1).match(b)){r++;continue}if(f=i.indexOf(">",r+1),-1==f){for(var o=t.line+1,k=!1,v=n.lineCount();o<v&&!k;){if(y=n.getLine(o),f=y.indexOf(">"),-1!=f&&(k=!0,s=y.lastIndexOf("/",f),-1!=s&&s<f&&(h=i.substr(s,f-s+1),!h.match(/\/\s*\>/))))return;o++}e=!0}else l=i.lastIndexOf("/",f),-1==l?e=!0:(h=i.substr(l,f-l+1),h.match(/\/\s*\>/)||(e=!0));e&&(d=i.substr(r+1),u=d.match(b),u?(u=u[0],-1!=i.indexOf("<\/"+u+">",r)&&(e=!1)):e=!1),e||r++}if(e){for(var nt="(\\<\\/"+u+"\\>)|(\\<"+u+"\\>)|(\\<"+u+"\\s)|(\\<"+u+"$)",tt=new RegExp(nt),it="<\/"+u+">",p=1,o=t.line+1,v=n.lineCount();o<v;){if(i=n.getLine(o),c=i.match(tt),c)for(a=0;a<c.length;a++)if(c[a]==it?p--:p++,!p)return{from:CodeMirror.Pos(t.line,f+1),to:CodeMirror.Pos(o,c.index)};o++}return}},CodeMirror.braceRangeFinder=function(n,t){for(var f=t.line,l=n.getLine(f),y=l.length,s,a,e,v,p,h,w,r,u,i,o,c;;){if(e=l.lastIndexOf("{",y),e<t.ch)break;if(a=n.getTokenAt(CodeMirror.Pos(f,e+1)).type,!/^(comment|string)/.test(a)){s=e;break}y=e-1}if(s!=null&&!(l.lastIndexOf("}")>s)){v=1,p=n.lineCount();n:for(r=f+1;r<p;++r)for(u=n.getLine(r),i=0;;){if(o=u.indexOf("{",i),c=u.indexOf("}",i),o<0&&(o=u.length),c<0&&(c=u.length),i=Math.min(o,c),i==u.length)break;if(n.getTokenAt(CodeMirror.Pos(r,i+1)).type==a)if(i==o)++v;else if(!--v){h=r,w=i;break n}++i}if(h!=null&&h!=f+1)return{from:CodeMirror.Pos(f,s+1),to:CodeMirror.Pos(h,w)}}},CodeMirror.indentRangeFinder=function(n,t){for(var r=n.getOption("tabSize"),f=n.getLine(t.line),e=CodeMirror.countColumn(f,null,r),u,i=t.line+1,o=n.lineCount();i<o;++i)if(u=n.getLine(i),CodeMirror.countColumn(u,null,r)<e&&CodeMirror.countColumn(n.getLine(i-1),null,r)>e)return{from:CodeMirror.Pos(t.line,f.length),to:CodeMirror.Pos(i,u.length)}},CodeMirror.newFoldFunction=function(n,t){if(t==null&&(t="↔"),typeof t=="string"){var i=document.createTextNode(t);t=document.createElement("span"),t.appendChild(i),t.className="CodeMirror-foldmarker"}return function(i,r){var u,e,o,f,s,h;if(typeof r=="number"&&(r=CodeMirror.Pos(r,0)),u=n(i,r),u){for(e=i.findMarksAt(u.from),o=0,f=0;f<e.length;++f)e[f].__isFold&&(++o,e[f].clear());if(!o){s=t.cloneNode(!0);CodeMirror.on(s,"mousedown",function(){h.clear()});h=i.markText(u.from,u.to,{replacedWith:s,clearOnEnter:!0,__isFold:!0})}}}},function(){CodeMirror.defineExtension("autoFormatAll",function(n,t){function v(){h+="\n",e=!0,++a}for(var r=this,f=r.getMode(),o=r.getRange(n,t).split("\n"),s=CodeMirror.copyState(f,r.getTokenAt(n).state),y=r.getOption("tabSize"),h="",a=0,e=n.ch==0,i,u=0;u<o.length;++u){for(i=new CodeMirror.StringStream(o[u],y);!i.eol();){var c=CodeMirror.innerMode(f,s),p=f.token(i,s),l=i.current();i.start=i.pos,(!e||/\S/.test(l))&&(h+=l,e=!1),!e&&c.mode.newlineAfterToken&&c.mode.newlineAfterToken(p,l,i.string.slice(i.pos)||o[u+1]||"",c.state)&&v()}!i.pos&&f.blankLine&&f.blankLine(s),!e&&u<o.length-1&&v()}r.operation(function(){r.replaceRange(h,n,t);for(var i=n.line+1,u=n.line+a;i<=u;++i)r.indentLine(i,"smart");r.setCursor({line:0,ch:0})})})}(),function(){CodeMirror.extendMode("css",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(n,t){return/^[;{}]$/.test(t)}}),CodeMirror.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(n,t,i,r){return this.jsonMode?/^[\[,{]$/.test(t)||/^}/.test(i):t==";"&&r.lexical&&r.lexical.type==")"?!1:/^[;{}]$/.test(t)&&!/^;/.test(i)}});var n=/^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/;CodeMirror.extendMode("xml",{commentStart:"<!--",commentEnd:"-->",newlineAfterToken:function(t,i,r,u){var f=!1;return this.configuration=="html"&&(f=u.context?n.test(u.context.tagName):!1),!f&&(t=="tag"&&/>$/.test(i)&&u.context||/^</.test(r))}}),CodeMirror.defineExtension("commentRange",function(n,t,i){var r=this,u=CodeMirror.innerMode(r.getMode(),r.getTokenAt(t).state).mode;r.operation(function(){if(n)r.replaceRange(u.commentEnd,i),r.replaceRange(u.commentStart,t),t.line==i.line&&t.ch==i.ch&&r.setCursor(t.line,t.ch+u.commentStart.length);else{var f=r.getRange(t,i),e=f.indexOf(u.commentStart),o=f.lastIndexOf(u.commentEnd);e>-1&&o>-1&&o>e&&(f=f.substr(0,e)+f.substring(e+u.commentStart.length,o)+f.substr(o+u.commentEnd.length)),r.replaceRange(f,t,i)}})}),CodeMirror.defineExtension("autoIndentRange",function(n,t){var i=this;this.operation(function(){for(var r=n.line;r<=t.line;r++)i.indentLine(r,"smart")})}),CodeMirror.defineExtension("autoFormatRange",function(n,t){function v(){h+="\n",e=!0,++a}for(var i=this,f=i.getMode(),o=i.getRange(n,t).split("\n"),s=CodeMirror.copyState(f,i.getTokenAt(n).state),y=i.getOption("tabSize"),h="",a=0,e=n.ch==0,r,u=0;u<o.length;++u){for(r=new CodeMirror.StringStream(o[u],y);!r.eol();){var c=CodeMirror.innerMode(f,s),p=f.token(r,s),l=r.current();r.start=r.pos,(!e||/\S/.test(l))&&(h+=l,e=!1),!e&&c.mode.newlineAfterToken&&c.mode.newlineAfterToken(p,l,r.string.slice(r.pos)||o[u+1]||"",c.state)&&v()}!r.pos&&f.blankLine&&f.blankLine(s),!e&&u<o.length-1&&v()}i.operation(function(){i.replaceRange(h,n,t);for(var r=n.line+1,u=n.line+a;r<=u;++r)i.indentLine(r,"smart");i.setSelection(n,i.getCursor(!1))})})}(),function(){function r(n){this.minChars=typeof n=="object"&&n.minChars||t,this.style=typeof n=="object"&&n.style||i,this.overlay=null}function n(n){n.operation(function(){var t=n._matchHighlightState,i;(t.overlay&&(n.removeOverlay(t.overlay),t.overlay=null),n.somethingSelected())&&((i=n.getSelection().replace(/^\s+|\s+$/g,""),i.length<t.minChars)||n.addOverlay(t.overlay=u(i,t.style)))})}function u(n,t){return{token:function(i){if(i.match(n))return t;i.next(),i.skipTo(n.charAt(0))||i.skipToEnd()}}}var t=2,i="matchhighlight";CodeMirror.defineOption("highlightSelectionMatches",!1,function(t,i,u){var e=u&&u!=CodeMirror.Init,f;if(i&&!e){t._matchHighlightState=new r(i);t.on("cursorActivity",n)}else!i&&e&&(f=t._matchHighlightState.overlay,f&&t.removeOverlay(f),t._matchHighlightState=null,t.off("cursorActivity",n))})}()
@@ -1 +0,0 @@
1
- window.CodeMirror=function(){"use strict";function n(t,i){var r,o,e,u,s;if(!(this instanceof n))return new n(t,i);this.options=i=i||{};for(r in rf)!i.hasOwnProperty(r)&&rf.hasOwnProperty(r)&&(i[r]=rf[r]);ce(i),o=typeof i.value=="string"?0:i.value.first,e=this.display=sl(t,o),e.wrapper.CodeMirror=this,ss(this),i.autofocus&&!oe&&w(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new wo},os(this),i.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),u=i.value,typeof u=="string"&&(u=new k(i.value,i.mode)),f(this,ec)(this,u),p&&setTimeout(nt(wt,this,!0),20),ra(this);try{s=document.activeElement==e.input}catch(h){}s||i.autofocus&&!oe?setTimeout(nt(bt,this),20):de(this),f(this,function(){var n,t;for(n in gt)gt.propertyIsEnumerable(n)&&gt[n](this,i[n],fo);for(t=0;t<ff.length;++t)ff[t](this)})()}function sl(n,t){var r={},u=r.input=i("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none;"),f;return ft?u.style.width="1000px":u.setAttribute("wrap","off"),u.setAttribute("autocorrect","off"),u.setAttribute("autocapitalize","off"),r.inputDiv=i("div",[u],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),r.scrollbarH=i("div",[i("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),r.scrollbarV=i("div",[i("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),r.scrollbarFiller=i("div",null,"CodeMirror-scrollbar-filler"),r.lineDiv=i("div"),r.selectionDiv=i("div",null,null,"position: relative; z-index: 1"),r.cursor=i("div"," ","CodeMirror-cursor"),r.otherCursor=i("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"),r.measure=i("div",null,"CodeMirror-measure"),r.lineSpace=i("div",[r.measure,r.selectionDiv,r.lineDiv,r.cursor,r.otherCursor],null,"position: relative; outline: none"),r.mover=i("div",[i("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=i("div",[r.mover],"CodeMirror-sizer"),r.heightForcer=i("div"," ",null,"position: absolute; height: "+di+"px"),r.gutters=i("div",null,"CodeMirror-gutters"),r.lineGutter=null,f=i("div",[r.sizer,r.heightForcer,r.gutters],null,"position: relative; min-height: 100%"),r.scroller=i("div",[f],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=i("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.scroller],"CodeMirror"),fi&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),n.appendChild?n.appendChild(r.wrapper):n(r.wrapper),uu&&(u.style.width="0px"),ft||(r.scroller.draggable=!0),ee?(r.inputDiv.style.height="1px",r.inputDiv.style.position="absolute"):fi&&(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 wo,r.draggingText=!1,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}function fu(t){t.doc.mode=n.getMode(t.options,t.doc.modeOption),t.doc.iter(function(n){n.stateAfter&&(n.stateAfter=null),n.styles&&(n.styles=null)}),t.doc.frontier=t.doc.first,hu(t,100),t.state.modeGen++,t.curOp&&c(t)}function hl(n){n.options.lineWrapping?(n.display.wrapper.className+=" CodeMirror-wrap",n.display.sizer.style.minWidth=""):(n.display.wrapper.className=n.display.wrapper.className.replace(" CodeMirror-wrap",""),he(n)),es(n),c(n),oi(n),setTimeout(function(){hs(n.display,n.doc.height)},100)}function fs(n){var t=vu(n.display),i=n.options.lineWrapping,r=i&&Math.max(5,n.display.scroller.clientWidth/ia(n.display)-3);return function(u){return ti(n.doc,u)?0:i?(Math.ceil(u.text.length/r)||1)*t:t}}function es(n){var t=n.doc,i=fs(n);t.iter(function(n){var t=i(n);t!=n.height&&it(n,t)})}function cl(n){var t=tt[n.options.keyMap].style;n.display.wrapper.className=n.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(t?" cm-keymap-"+t:"")}function os(n){n.display.wrapper.className=n.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+n.options.theme.replace(/(^|\s)\s*/g," cm-s-"),oi(n)}function ir(n){ss(n),c(n)}function ss(n){var r=n.display.gutters,e=n.options.gutters,t,u,f;for(ne(r),t=0;t<e.length;++t)u=e[t],f=r.appendChild(i("div",null,"CodeMirror-gutter "+u)),u=="CodeMirror-linenumbers"&&(n.display.lineGutter=f,f.style.width=(n.display.lineNumWidth||1)+"px");r.style.display=t?"":"none"}function eu(n,t){var f,e,u,i;if(t.height==0)return 0;for(f=t.text.length,u=t;e=sf(u);)i=e.find(),u=r(n,i.from.line),f+=i.from.ch-i.to.ch;for(u=t;e=br(u);)i=e.find(),f-=u.text.length-i.from.ch,u=r(n,i.to.line),f+=u.text.length-i.to.ch;return f}function he(n){var t=n.display,i=n.doc;t.maxLine=r(i,i.first),t.maxLineLength=eu(i,t.maxLine),t.maxLineChanged=!0,i.iter(function(n){var r=eu(i,n);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=n)})}function ce(n){for(var i=!1,t=0;t<n.gutters.length;++t)n.gutters[t]=="CodeMirror-linenumbers"&&(n.lineNumbers?i=!0:n.gutters.splice(t--,1));!i&&n.lineNumbers&&n.gutters.push("CodeMirror-linenumbers")}function hs(n,t){var u=t+2*cu(n);n.sizer.style.minHeight=n.heightForcer.style.top=u+"px";var f=Math.max(u,n.scroller.scrollHeight),i=n.scroller.scrollWidth>n.scroller.clientWidth,r=f>n.scroller.clientHeight;r?(n.scrollbarV.style.display="block",n.scrollbarV.style.bottom=i?ie(n.measure)+"px":"0",n.scrollbarV.firstChild.style.height=f-n.scroller.clientHeight+n.scrollbarV.clientHeight+"px"):n.scrollbarV.style.display="",i?(n.scrollbarH.style.display="block",n.scrollbarH.style.right=r?ie(n.measure)+"px":"0",n.scrollbarH.firstChild.style.width=n.scroller.scrollWidth-n.scroller.clientWidth+n.scrollbarH.clientWidth+"px"):n.scrollbarH.style.display="",i&&r?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=n.scrollbarFiller.style.width=ie(n.measure)+"px"):n.scrollbarFiller.style.display="",ul&&ie(n.measure)===0&&(n.scrollbarV.style.minWidth=n.scrollbarH.style.minHeight=fl?"18px":"12px")}function le(n,t,i){var r=n.scroller.scrollTop,u=n.wrapper.clientHeight,f;return typeof i=="number"?r=i:i&&(r=i.top,u=i.bottom-i.top),r=Math.floor(r-cu(n)),f=Math.ceil(r+u),{from:vf(t,r),to:vf(t,f)}}function cs(n){var t=n.display,i,r,u;if(t.alignWidgets||t.gutters.firstChild&&n.options.fixedGutter){var f=ve(t)-t.scroller.scrollLeft+n.doc.scrollLeft,e=t.gutters.offsetWidth,o=f+"px";for(i=t.lineDiv.firstChild;i;i=i.nextSibling)if(i.alignable)for(r=0,u=i.alignable;r<u.length;++r)u[r].style.left=o;n.options.fixedGutter&&(t.gutters.style.left=f+e+"px")}}function ll(n){if(!n.options.lineNumbers)return!1;var u=n.doc,r=ae(n.options,u.first+u.size-1),t=n.display;if(r.length!=t.lineNumChars){var f=t.measure.appendChild(i("div",[i("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=f.firstChild.offsetWidth,o=f.offsetWidth-e;return t.lineGutter.style.width="",t.lineNumInnerWidth=Math.max(e,t.lineGutter.offsetWidth-o),t.lineNumWidth=t.lineNumInnerWidth+o,t.lineNumChars=t.lineNumInnerWidth?r.length:-1,t.lineGutter.style.width=t.lineNumWidth+"px",!0}return!1}function ae(n,t){return String(n.lineNumberFormatter(t+n.firstLineNumber))}function ve(n){return l(n.scroller).left-l(n.sizer).left}function ou(n,t,i){var u=n.display.showingFrom,f=n.display.showingTo,r=ls(n,t,i);return r&&(ut(n,"update",n),(n.display.showingFrom!=u||n.display.showingTo!=f)&&ut(n,"viewportChange",n,n.display.showingFrom,n.display.showingTo)),pe(n),hs(n.display,n.doc.height),r}function ls(n,t,i){var u=n.display,e=n.doc,y,et,g,c,ot,nt,b,s,k,st,tt,a,v,rt,ut,ft,p,f;if(!u.wrapper.clientWidth){u.showingFrom=u.showingTo=e.first,u.viewOffset=0;return}if(y=le(u,e,i),t.length!=0||!(y.from>u.showingFrom)||!(y.to<u.showingTo)){if(ll(n)&&(t=[{from:e.first,to:e.first+e.size}]),et=u.sizer.style.marginLeft=u.gutters.offsetWidth+"px",u.scrollbarH.style.left=n.options.fixedGutter?et:"0",g=Infinity,n.options.lineNumbers)for(f=0;f<t.length;++f)if(t[f].diff){g=t[f].from;break}var w=e.first+e.size,h=Math.max(y.from-n.options.viewportMargin,e.first),o=Math.min(w,y.to+n.options.viewportMargin);if(u.showingFrom<h&&h-u.showingFrom<20&&(h=Math.max(e.first,u.showingFrom)),u.showingTo>o&&u.showingTo-o<20&&(o=Math.min(w,u.showingTo)),tr)for(h=d(yi(e,r(e,h)));o<w&&ti(e,r(e,o));)++o;if(c=[{from:Math.max(u.showingFrom,e.first),to:Math.min(u.showingTo,w)}],c=c[0].from>=c[0].to?[]:al(c,t),tr)for(f=0;f<c.length;++f)for(s=c[f];ot=br(r(e,s.to-1));)if(nt=ot.find().from.line,nt>s.from)s.to=nt;else{c.splice(f--,1);break}for(b=0,f=0;f<c.length;++f)s=c[f],s.from<h&&(s.from=h),s.to>o&&(s.to=o),s.from>=s.to?c.splice(f--,1):b+=s.to-s.from;if(b==o-h&&h==u.showingFrom&&o==u.showingTo){as(n);return}for(c.sort(function(n,t){return n.from-t.from}),k=document.activeElement,b<(o-h)*.7&&(u.lineDiv.style.display="none"),yl(n,h,o,c,g),u.lineDiv.style.display="",document.activeElement!=k&&k.offsetHeight&&k.focus(),st=h!=u.showingFrom||o!=u.showingTo||u.lastSizeC!=u.wrapper.clientHeight,st&&(u.lastSizeC=u.wrapper.clientHeight),u.showingFrom=h,u.showingTo=o,hu(n,100),tt=u.lineDiv.offsetTop,a=u.lineDiv.firstChild;a;a=a.nextSibling)if(a.lineObj&&(fi?(rt=a.offsetTop+a.offsetHeight,v=rt-tt,tt=rt):(ut=l(a),v=ut.bottom-ut.top),ft=a.lineObj.height-v,v<2&&(v=vu(u)),(ft>.001||ft<-.001)&&(it(a.lineObj,v),p=a.lineObj.widgets,p)))for(f=0;f<p.length;++f)p[f].height=p[f].node.offsetHeight;return as(n),le(u,e,i).to>o&&ls(n,[],i),!0}}function as(n){var t=n.display.viewOffset=bi(n,r(n.doc,n.display.showingFrom));n.display.mover.style.top=t+"px"}function al(n,t){for(var o,h,i,f=0,s=t.length||0;f<s;++f){var r=t[f],u=[],e=r.diff||0;for(o=0,h=n.length;o<h;++o)i=n[o],r.to<=i.from&&r.diff?u.push({from:i.from+e,to:i.to+e}):r.to<=i.from||r.from>=i.to?u.push(i):(r.from>i.from&&u.push({from:i.from,to:r.from}),r.to<i.to&&u.push({from:r.to+e,to:i.to+e}));n=u}return n}function vl(n){for(var i=n.display,u={},f={},t=i.gutters.firstChild,r=0;t;t=t.nextSibling,++r)u[n.options.gutters[r]]=t.offsetLeft,f[n.options.gutters[r]]=t.offsetWidth;return{fixedPos:ve(i),gutterTotalWidth:i.gutters.offsetWidth,gutterLeft:u,gutterWidth:f,wrapperWidth:i.wrapper.clientWidth}}function yl(n,t,r,u,f){function c(t){var i=t.nextSibling;return ft&&ei&&n.display.currentWheelTarget==t?(t.style.display="none",t.lineObj=null):t.parentNode.removeChild(t),i}var l=vl(n),a=n.display,v=n.options.lineNumbers,h,e,s,o;for(u.length||ft&&n.display.currentWheelTarget||ne(a.lineDiv),h=a.lineDiv,e=h.firstChild,s=u.shift(),o=t,n.doc.iter(t,r,function(t){var y,r,p,d,k,a,w,b;if(s&&s.to==o&&(s=u.shift()),ti(n.doc,t)){if(t.height!=0&&it(t,0),t.widgets&&e.previousSibling)for(y=0;y<t.widgets.length;++y)t.widgets[y].showIfHidden&&(r=e.previousSibling,/pre/i.test(r.nodeName)&&(p=i("div",null,null,"position: relative"),r.parentNode.replaceChild(p,r),p.appendChild(r),r=p),d=r.appendChild(i("div",[t.widgets[y].node],"CodeMirror-linewidget")),ye(t.widgets[y],d,r,l))}else if(s&&s.from<=o&&s.to>o){while(e.lineObj!=t)e=c(e);v&&f<=o&&e.lineNumber&&kc(e.lineNumber,ae(n.options,o)),e=e.nextSibling}else{if(t.widgets)for(k=0,a=e;a&&k<20;++k,a=a.nextSibling)if(a.lineObj==t&&/div/i.test(a.nodeName)){w=a;break}if(b=pl(n,t,o,l,w),b!=w)h.insertBefore(b,e);else{while(e!=w)e=c(e);e=e.nextSibling}b.lineObj=t}++o});e;)e=c(e)}function pl(n,t,r,u,f){var v=tc(n,t),c=t.gutterMarkers,it=n.display,e,w,b,h,tt,k,d,l,y,a,g,o,nt,s,p;if(!n.options.lineNumbers&&!c&&!t.bgClass&&!t.wrapClass&&!t.widgets)return v;if(f){for(f.alignable=null,w=!0,b=0,h=f.firstChild;h;h=tt)if(tt=h.nextSibling,/\bCodeMirror-linewidget\b/.test(h.className)){for(o=0,k=!0;o<t.widgets.length;++o)if(s=t.widgets[o],d=!1,s.above||(d=k,k=!1),s.node==h.firstChild){ye(s,h,f,u),++b,d&&f.insertBefore(v,h);break}if(o==t.widgets.length){w=!1;break}}else f.removeChild(h);w&&b==t.widgets.length&&(e=f,f.className=t.wrapClass||"")}if(e||(e=i("div",null,t.wrapClass,"position: relative"),e.appendChild(v)),t.bgClass&&e.insertBefore(i("div"," ",t.bgClass+" CodeMirror-linebackground"),e.firstChild),(n.options.lineNumbers||c)&&(l=e.insertBefore(i("div",null,null,"position: absolute; left: "+(n.options.fixedGutter?u.fixedPos:-u.gutterTotalWidth)+"px"),e.firstChild),n.options.fixedGutter&&(e.alignable||(e.alignable=[])).push(l),!n.options.lineNumbers||c&&c["CodeMirror-linenumbers"]||(e.lineNumber=l.appendChild(i("div",ae(n.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+u.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+it.lineNumInnerWidth+"px"))),c))for(y=0;y<n.options.gutters.length;++y)a=n.options.gutters[y],g=c.hasOwnProperty(a)&&c[a],g&&l.appendChild(i("div",[g],"CodeMirror-gutter-elt","left: "+u.gutterLeft[a]+"px; width: "+u.gutterWidth[a]+"px"));if(fi&&(e.style.zIndex=2),t.widgets&&e!=f)for(o=0,nt=t.widgets;o<nt.length;++o)s=nt[o],p=i("div",[s.node],"CodeMirror-linewidget"),ye(s,p,e,u),s.above?e.insertBefore(p,n.options.lineNumbers&&t.height!=0?l:v):e.appendChild(p),ut(s,"redraw");return e}function ye(n,t,i,r){if(n.noHScroll){(i.alignable||(i.alignable=[])).push(t);var u=r.wrapperWidth;t.style.left=r.fixedPos+"px",n.coverGutter||(u-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=u+"px"}n.coverGutter&&(t.style.zIndex=5,t.style.position="relative",n.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function pe(n){var t=n.display,i=s(n.doc.sel.from,n.doc.sel.to);i||n.options.showCursorWhenSelecting?wl(n):t.cursor.style.display=t.otherCursor.style.display="none",i?t.selectionDiv.style.display="none":bl(n);var r=ot(n,n.doc.sel.head,"div"),u=l(t.wrapper),f=l(t.lineDiv);t.inputDiv.style.top=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+f.top-u.top))+"px",t.inputDiv.style.left=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+f.left-u.left))+"px"}function wl(n){var t=n.display,i=ot(n,n.doc.sel.head,"div");t.cursor.style.left=i.left+"px",t.cursor.style.top=i.top+"px",t.cursor.style.height=Math.max(0,i.bottom-i.top)*n.options.cursorHeight+"px",t.cursor.style.display="",i.other?(t.otherCursor.style.display="",t.otherCursor.style.left=i.other.left+"px",t.otherCursor.style.top=i.other.top+"px",t.otherCursor.style.height=(i.other.bottom-i.other.top)*.85+"px"):t.otherCursor.style.display="none"}function bl(n){function l(n,t,r,u){t<0&&(t=0),w.appendChild(i("div",null,"CodeMirror-selected","position: absolute; left: "+n+"px; top: "+t+"px; width: "+(r==null?b-n:r)+"px; height: "+(u-t)+"px"))}function a(i,u,f,e){function v(r){return we(n,t(i,r),"div",s)}var s=r(c,i),a=s.text.length,o=e?Infinity:-Infinity;return av(rt(s),u||0,f==null?a:f,function(n,t,i){var c=v(i=="rtl"?t-1:n),r=v(i=="rtl"?n:t-1),s=c.left,y=r.right;r.top-c.top>3&&(l(s,c.top,null,c.bottom),s=h,c.bottom<r.top&&l(s,c.bottom,null,r.top)),f==null&&t==a&&(y=b),u==null&&n==0&&(s=h),o=e?Math.min(r.top,o):Math.max(r.bottom,o),s<h+1&&(s=h),l(s,r.top,y-s,r.bottom)}),o}var s=n.display,c=n.doc,u=n.doc.sel,w=document.createDocumentFragment(),b=s.lineSpace.offsetWidth,h=gl(n.display),e,o,v,y,p;if(u.from.line==u.to.line)a(u.from.line,u.from.ch,u.to.ch);else{for(var k=r(c,u.from.line),d=k,g,f=[u.from.line,u.from.ch],nt;g=br(d);){if(e=g.find(),f.push(e.from.ch,e.to.line,e.to.ch),e.to.line==u.to.line){f.push(u.to.ch),nt=!0;break}d=r(c,e.to.line)}if(nt)for(o=0;o<f.length;o+=3)a(f[o],f[o+1],f[o+2]);else p=r(c,u.to.line),v=u.from.ch?a(u.from.line,u.from.ch,null,!1):bi(n,k)-s.viewOffset,y=u.to.ch?a(u.to.line,sf(p)?null:0,u.to.ch,!0):bi(n,p)-s.viewOffset,v<y&&l(h,v,null,y)}ct(s.selectionDiv,w),s.selectionDiv.style.display=""}function su(n){var t=n.display,i;clearInterval(t.blinker),i=!0,t.cursor.style.visibility=t.otherCursor.style.visibility="",t.blinker=setInterval(function(){t.cursor.offsetHeight&&(t.cursor.style.visibility=t.otherCursor.style.visibility=(i=!i)?"":"hidden")},n.options.cursorBlinkRate)}function hu(n,t){n.doc.mode.startState&&n.doc.frontier<n.display.showingTo&&n.state.highlight.set(t,nt(kl,n))}function kl(n){var t=n.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=n.display.showingTo)){var e=+new Date+n.options.workTime,r=vi(t.mode,rr(n,t.frontier)),i=[],u;t.iter(t.frontier,Math.min(t.first+t.size,n.display.showingTo+500),function(f){var o,h,s;if(t.frontier>=n.display.showingFrom){for(o=f.styles,f.styles=dh(n,f,r),h=!o||o.length!=f.styles.length,s=0;!h&&s<o.length;++s)h=o[s]!=f.styles[s];h&&(u&&u.end==t.frontier?u.end++:i.push(u={start:t.frontier,end:t.frontier+1})),f.stateAfter=vi(t.mode,r)}else gh(n,f,r),f.stateAfter=t.frontier%5==0?vi(t.mode,r):null;return++t.frontier,+new Date>e?(hu(n,n.options.workDelay),!0):void 0}),i.length&&f(n,function(){for(var n=0;n<i.length;++n)c(this,i[n].start,i[n].end)})()}}function dl(n,t){for(var s,u,f=n.doc,e,o,i=t,h=t-100;i>h;--i){if(i<=f.first)return f.first;if(e=r(f,i-1),e.stateAfter)return i;o=gi(e.text,null,n.options.tabSize),(u==null||s>o)&&(u=i-1,s=o)}return u}function rr(n,t){var u=n.doc,e=n.display,i,f;return u.mode.startState?(i=dl(n,t),f=i>u.first&&r(u,i-1).stateAfter,f=f?vi(u.mode,f):lh(u.mode),u.iter(i,t,function(r){gh(n,r,f);var o=i==t-1||i%5==0||i>=e.showingFrom&&i<e.showingTo;r.stateAfter=o?vi(u.mode,f):null,++i}),f):!0}function cu(n){return n.lineSpace.offsetTop}function gl(n){var t=ct(n.measure,i("pre",null,null,"text-align: left")).appendChild(i("span","x"));return t.offsetLeft}function vs(n,t,i,r){var e=-1,f,u;for(r=r||lu(n,t),f=i;;f+=e){if(u=r[f],u)break;e<0&&f==0&&(e=1)}return{left:f<i?u.right:u.left,right:f>i?u.left:u.right,top:u.top,bottom:u.bottom}}function lu(n,t){for(var f=n.display,r=n.display.measureLineCache,e,i,u=0;u<r.length;++u)if(i=r[u],i.text==t.text&&i.markedSpans==t.markedSpans&&f.scroller.clientWidth==i.width&&i.classes==t.textClass+"|"+t.bgClass+"|"+t.wrapClass)return i.measure;return e=na(n,t),i={text:t.text,width:f.scroller.clientWidth,markedSpans:t.markedSpans,measure:e,classes:t.textClass+"|"+t.bgClass+"|"+t.wrapClass},r.length==16?r[++f.measureLineCachePos%16]=i:r.push(i),e}function na(n,t){var w=n.display,d=pc(t.text.length),f=tc(n,t,d),ft,nt,u,c,a,tt,r,o,it,k;if(p&&!fi&&!n.options.lineWrapping&&f.childNodes.length>100){var rt=document.createDocumentFragment(),ut=10,g=f.childNodes.length;for(r=0,ft=Math.ceil(g/ut);r<ft;++r){for(nt=i("div",null,null,"display: inline-block"),u=0;u<ut&&g;++u)nt.appendChild(f.firstChild),--g;rt.appendChild(nt)}f.appendChild(rt)}ct(w.measure,f);var v=l(w.lineDiv),e=[],y=pc(t.text.length),et=f.offsetHeight;for(yt&&w.measure.first!=f&&ct(w.measure,f),r=0;r<d.length;++r)if(o=d[r]){var b=l(o),s=Math.max(0,b.top-v.top),h=Math.min(b.bottom-v.top,et);for(u=0;u<e.length;u+=2)if((c=e[u],a=e[u+1],!(c>h)&&!(a<s))&&(c<=s&&a>=h||s<=c&&h>=a||Math.min(h,a)-Math.max(s,c)>=h-s>>1)){e[u]=Math.min(s,c),e[u+1]=Math.max(h,a);break}u==e.length&&e.push(s,h),tt=b.right,o.measureRight&&(tt=l(o.measureRight).left),y[r]={left:b.left-v.left,right:tt-v.left,top:u}}for(r=0;r<y.length;++r)(o=y[r])&&(it=o.top,o.top=e[it],o.bottom=e[it+1]);return n.options.lineWrapping||(k=f.lastChild,k.nodeType==3&&(k=f.appendChild(i("span","​"))),y.width=l(k).right-v.left),y}function oi(n){n.display.measureLineCache.length=n.display.measureLineCachePos=0,n.display.cachedCharWidth=n.display.cachedTextHeight=null,n.display.maxLineChanged=!0,n.display.lineNumChars=null}function ys(n,t,i,r){var u,e,f,o,s;if(t.widgets)for(u=0;u<t.widgets.length;++u)t.widgets[u].above&&(e=cf(t.widgets[u]),i.top+=e,i.bottom+=e);return r=="line"?i:(r||(r="local"),f=bi(n,t),r!="local"&&(f-=n.display.viewOffset),r=="page"&&(o=l(n.display.lineSpace),f+=o.top+(window.pageYOffset||(document.documentElement||document.body).scrollTop),s=o.left+(window.pageXOffset||(document.documentElement||document.body).scrollLeft),i.left+=s,i.right+=s),i.top+=f,i.bottom+=f,i)}function we(n,t,i,u){return u||(u=r(n.doc,t.line)),ys(n,u,vs(n,u,t.ch),i)}function ot(n,t,i,u,f){function a(t,r){var e=vs(n,u,t,f);return r?e.left=e.right:e.right=e.left,ys(n,u,e,i)}var h,o,p,v,w,l,s,c,y,b,k,e;if(u=u||r(n.doc,t.line),f||(f=lu(n,u)),h=rt(u),o=t.ch,!h)return a(o);for(w=h[0].level,l=0;l<h.length;++l){if(s=h[l],c=s.level%2,s.from<o&&s.to>o)return a(o,c);if(b=c?s.to:s.from,k=c?s.from:s.to,b==o)y=l&&s.level<(e=h[l-1]).level?a(e.level%2?e.from:e.to-1,!0):a(c&&s.from!=s.to?o-1:o),c==w?p=y:v=y;else if(k==o){if(e=l<h.length-1&&h[l+1],!c&&e&&e.from==e.to)continue;y=e&&s.level<e.level?a(e.level%2?e.to-1:e.from):a(c?o:o-1,!0),c==w?p=y:v=y}}return(w&&!o&&(v=a(h[0].to-1)),!p)?v:(v&&(p.other=v),p)}function au(n,i,r){var u=new t(n,i);return r&&(u.outside=!0),u}function be(n,t,i){var u=n.doc,f,e;if(i+=n.display.viewOffset,i<0)return au(u.first,0,!0);if(f=vf(u,i),e=u.first+u.size-1,f>e)return au(u.first+u.size-1,r(u,e).text.length,!0);for(t<0&&(t=0);;){var s=r(u,f),h=ta(n,s,f,t,i),o=br(s),c=o&&o.find();if(o&&h.ch>=c.from.ch)f=c.to.line;else return h}}function ta(n,i,r,u,f){function p(u){var f=ot(n,t(r,u),"line",i,ft);return(h=!0,g>f.bottom)?Math.max(0,f.left-nt):g<f.top?f.left+nt:(h=!1,f.left)}var g=f-bi(n,i),h=!1,nt=n.display.wrapper.clientWidth,ft=lu(n,i),tt=rt(i),w=i.text.length,e=re(i),o=ue(i),it=p(e),ut=h,l=p(o),b=h,a,v,k,c,s,d,y;if(u>l)return au(r,o,b);for(;;){if(tt?o==e||o==ts(i,e,1):o-e<=1){for(a=u-it<l-u,v=a?e:o;gf.test(i.text.charAt(v));)++v;return k=au(r,v,a?ut:b),k.after=a,k}if(c=Math.ceil(w/2),s=e+c,tt)for(s=e,d=0;d<c;++d)s=ts(i,s,1);y=p(s),y>u?(o=s,l=y,(b=h)&&(l+=1e3),w-=c):(e=s,it=y,ut=h,w=c)}}function vu(n){var r,t;if(n.cachedTextHeight!=null)return n.cachedTextHeight;if(pt==null){for(pt=i("pre"),r=0;r<49;++r)pt.appendChild(document.createTextNode("x")),pt.appendChild(i("br"));pt.appendChild(document.createTextNode("x"))}return ct(n.measure,pt),t=pt.offsetHeight/50,t>3&&(n.cachedTextHeight=t),ne(n.measure),t||1}function ia(n){var r,u,t;return n.cachedCharWidth!=null?n.cachedCharWidth:(r=i("span","x"),u=i("pre",[r]),ct(n.measure,u),t=r.offsetWidth,t>2&&(n.cachedCharWidth=t),t||10)}function si(n){n.curOp={changes:[],updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,updateMaxLine:!1,updateScrollPos:!1,id:++ps},tu++||(vt=[])}function hi(n){var t=n.curOp,s=n.doc,r=n.display,l,c,u,a,f,e,o,h,i;if(n.curOp=null,t.updateMaxLine&&he(n),r.maxLineChanged&&!n.options.lineWrapping&&(l=lu(n,r.maxLine).width,r.sizer.style.minWidth=Math.max(0,l+3+di)+"px",r.maxLineChanged=!1,c=Math.max(0,r.sizer.offsetLeft+r.sizer.offsetWidth-r.scroller.clientWidth),c<s.scrollLeft&&!t.updateScrollPos&&li(n,Math.min(r.scroller.scrollLeft,c),!0)),t.updateScrollPos?u=t.updateScrollPos:t.selectionChanged&&r.scroller.clientHeight&&(f=ot(n,s.sel.head),u=ro(n,f.left,f.top,f.left,f.bottom)),(t.changes.length||u&&u.scrollTop!=null)&&(a=ou(n,t.changes,u&&u.scrollTop)),!a&&t.selectionChanged&&pe(n),t.updateScrollPos?(r.scroller.scrollTop=r.scrollbarV.scrollTop=s.scrollTop=u.scrollTop,r.scroller.scrollLeft=r.scrollbarH.scrollLeft=s.scrollLeft=u.scrollLeft,cs(n)):u&&va(n),t.selectionChanged&&su(n),n.state.focused&&t.updateInput&&wt(n,t.userSelChange),e=t.maybeHiddenMarkers,o=t.maybeUnhiddenMarkers,e)for(i=0;i<e.length;++i)e[i].lines.length||g(e[i],"hide");if(o)for(i=0;i<o.length;++i)o[i].lines.length&&g(o[i],"unhide");if(--tu||(h=vt,vt=null),t.textChanged&&g(n,"change",n,t.textChanged),t.selectionChanged&&g(n,"cursorActivity",n),h)for(i=0;i<h.length;++i)h[i]()}function f(n,t){return function(){var i=n||this,r=!i.curOp,u;r&&si(i);try{u=t.apply(i,arguments)}finally{r&&hi(i)}return u}}function ur(n){return function(){var t=this.cm&&!this.cm.curOp,i;t&&si(this.cm);try{i=n.apply(this,arguments)}finally{t&&hi(this.cm)}return i}}function ws(n,t){var i=!n.curOp,r;i&&si(n);try{r=t()}finally{i&&hi(n)}return r}function c(n,t,i,r){t==null&&(t=n.doc.first),i==null&&(i=n.doc.first+n.doc.size),n.curOp.changes.push({from:t,to:i,diff:r})}function yu(n){n.display.pollingFast||n.display.poll.set(n.options.pollInterval,function(){ke(n),n.state.focused&&yu(n)})}function fr(n){function i(){var r=ke(n);r||t?(n.display.pollingFast=!1,yu(n)):(t=!0,n.display.poll.set(60,i))}var t=!1;n.display.pollingFast=!0,n.display.poll.set(20,i)}function ke(n){var c=n.display.input,o=n.display.prevInput,a=n.doc,h=a.sel,i,l,u,v,e,f,y;if(!n.state.focused||lv(c)||er(n)||(i=c.value,i==o&&s(h.from,h.to)))return!1;if(p&&i&&c.selectionStart===0)return wt(n,!0),!1;for(l=!n.curOp,l&&si(n),h.shift=!1,u=0,v=Math.min(o.length,i.length);u<v&&o[u]==i[u];)++u;return e=h.from,f=h.to,u<o.length?e=t(e.line,e.ch-(o.length-u)):n.state.overwrite&&s(e,f)&&!n.state.pasteIncoming&&(f=t(f.line,Math.min(r(a,f.line).text.length,f.ch+(i.length-u)))),y=n.curOp.updateInput,cr(n.doc,{from:e,to:f,text:ii(i.slice(u)),origin:n.state.pasteIncoming?"paste":"+input"},"end"),n.curOp.updateInput=y,i.length>1e3?c.value=n.display.prevInput="":n.display.prevInput=i,l&&hi(n),n.state.pasteIncoming=!1,!0}function wt(n,t){var r,u,i=n.doc;s(i.sel.from,i.sel.to)?t&&(n.display.prevInput=n.display.input.value=""):(n.display.prevInput="",r=gc&&(i.sel.to.line-i.sel.from.line>100||(u=n.getSelection()).length>1e3),n.display.input.value=r?"-":u||n.getSelection(),n.state.focused&&yc(n.display.input)),n.display.inaccurateSelection=r}function w(n){n.options.readOnly=="nocursor"||oe&&document.activeElement==n.display.input||n.display.input.focus()}function er(n){return n.options.readOnly||n.doc.cantEdit}function ra(n){function i(){n.state.focused&&setTimeout(nt(w,n),0)}function r(){t.cachedCharWidth=t.cachedTextHeight=null,oi(n),ws(n,nt(c,n))}function u(){for(var n=t.wrapper.parentNode;n&&n!=document.body;n=n.parentNode);n?setTimeout(u,5e3):st(window,"resize",r)}function o(t){n.options.onDragEvent&&n.options.onDragEvent(n,nu(t))||bf(t)}function s(){t.inaccurateSelection&&(t.prevInput="",t.inaccurateSelection=!1,t.input.value=n.getSelection(),yc(t.input))}var t=n.display;e(t.scroller,"mousedown",f(n,ua)),e(t.scroller,"dblclick",f(n,a)),e(t.lineSpace,"selectstart",function(n){ci(t,n)||a(n)}),se||e(t.scroller,"contextmenu",function(t){th(n,t)}),e(t.scroller,"scroll",function(){sr(n,t.scroller.scrollTop),li(n,t.scroller.scrollLeft,!0),g(n,"scroll",n)}),e(t.scrollbarV,"scroll",function(){sr(n,t.scrollbarV.scrollTop)}),e(t.scrollbarH,"scroll",function(){li(n,t.scrollbarH.scrollLeft)}),e(t.scroller,"mousewheel",function(t){bs(n,t)}),e(t.scroller,"DOMMouseScroll",function(t){bs(n,t)}),e(t.scrollbarH,"mousedown",i),e(t.scrollbarV,"mousedown",i),e(t.wrapper,"scroll",function(){t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),e(window,"resize",r),setTimeout(u,5e3),e(t.input,"keyup",f(n,function(t){n.options.onKeyEvent&&n.options.onKeyEvent(n,nu(t))||t.keyCode==16&&(n.doc.sel.shift=!1)})),e(t.input,"input",nt(fr,n)),e(t.input,"keydown",f(n,nh)),e(t.input,"keypress",f(n,ha)),e(t.input,"focus",nt(bt,n)),e(t.input,"blur",nt(de,n)),n.options.dragDrop&&(e(t.scroller,"dragstart",function(t){oa(n,t)}),e(t.scroller,"dragenter",o),e(t.scroller,"dragover",o),e(t.scroller,"drop",f(n,fa))),e(t.scroller,"paste",function(i){ci(t,i)||(w(n),fr(n))}),e(t.input,"paste",function(){n.state.pasteIncoming=!0,fr(n)}),e(t.input,"cut",s),e(t.input,"copy",s),ee&&e(t.sizer,"mouseup",function(){document.activeElement==t.input&&t.input.blur(),w(n)})}function ci(n,t){for(var i=yo(t);i!=n.wrapper;i=i.parentNode)if(!i||/\bCodeMirror-(?:line)?widget\b/.test(i.className)||i.parentNode==n.sizer&&i!=n.mover)return!0}function or(n,t,i){var r=n.display,u,e,o,f;if(!i&&(u=yo(t),u==r.scrollbarH||u==r.scrollbarH.firstChild||u==r.scrollbarV||u==r.scrollbarV.firstChild||u==r.scrollbarFiller))return null;f=l(r.lineSpace);try{e=t.clientX,o=t.clientY}catch(t){return null}return be(n,e-f.left,o-f.top)}function ua(n){function at(n){if(b=="single"){v(i.doc,u(y,o),n);return}if(d=u(y,d),it=u(y,it),b=="double"){var f=ch(r(y,n.line).text,n);h(n,d)?v(i.doc,f.from,it):v(i.doc,d,f.to)}else b=="triple"&&(h(n,d)?v(i.doc,it,u(y,t(n.line,0))):v(i.doc,d,u(y,t(n.line+1,0))))}function ht(n){var e=++rt,t=or(i,n,!0),r,u;t&&(s(t,et)?(u=n.clientY<ot.top?-20:n.clientY>ot.bottom?20:0,u&&setTimeout(f(i,function(){rt==e&&(c.scroller.scrollTop+=u,ht(n))}),50)):(i.state.focused||bt(i),et=t,at(t),r=le(c,y),(t.line>=r.to||t.line<r.from)&&setTimeout(f(i,function(){rt==e&&ht(n)}),150)))}function vt(n){rt=Infinity;var t=or(i,n);t&&at(t),a(n),w(i),st(document,"mousemove",ct),st(document,"mouseup",lt)}var i=this,c=i.display,y=i.doc,k=y.sel,o,tt,b,ut,et,g,d,it,ot,rt,ct,lt;if(k.shift=n.shiftKey,ci(c,n)){ft||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100));return}if(!ea(i,n)){o=or(i,n);switch(ac(n)){case 3:se&&th.call(i,i,n);return;case 2:o&&v(i.doc,o),setTimeout(nt(w,i),20),a(n);return}if(!o){yo(n)==c.scroller&&a(n);return}if(i.state.focused||bt(i),tt=+new Date,b="single",wu&&wu.time>tt-400&&s(wu.pos,o)?(b="triple",a(n),setTimeout(nt(w,i),20),ya(i,o.line)):pu&&pu.time>tt-400&&s(pu.pos,o)?(b="double",wu={time:tt,pos:o},a(n),ut=ch(r(y,o.line).text,o),v(i.doc,ut.from,ut.to)):pu={time:tt,pos:o},et=o,i.options.dragDrop&&dc&&!er(i)&&!s(k.from,k.to)&&!h(o,k.from)&&!h(k.to,o)&&b=="single"){g=f(i,function(t){ft&&(c.scroller.draggable=!1),i.state.draggingText=!1,st(document,"mouseup",g),st(c.scroller,"drop",g),Math.abs(n.clientX-t.clientX)+Math.abs(n.clientY-t.clientY)<10&&(a(t),v(i.doc,o),w(i))}),ft&&(c.scroller.draggable=!0),i.state.draggingText=g,c.scroller.dragDrop&&c.scroller.dragDrop(),e(document,"mouseup",g),e(c.scroller,"drop",g);return}a(n),b=="single"&&v(i.doc,u(y,o)),d=k.from,it=k.to,ot=l(c.wrapper),rt=0,ct=f(i,function(n){p||ac(n)?ht(n):vt(n)}),lt=f(i,vt),e(document,"mousemove",ct),e(document,"mouseup",lt)}}function fa(n){var t=this,i,f,e,r,s,c;if(!ci(t.display,n)&&(!t.options.onDragEvent||!t.options.onDragEvent(t,nu(n)))&&(a(n),i=or(t,n,!0),f=n.dataTransfer.files,i&&!er(t)))if(f&&f.length&&window.FileReader&&window.File){var o=f.length,r=Array(o),l=0,v=function(n,f){var e=new FileReader;e.onload=function(){r[f]=e.result,++l==o&&(i=u(t.doc,i),lt(t.doc,r.join(""),i,"around","paste"))},e.readAsText(n)};for(e=0;e<o;++e)v(f[e],e)}else{if(t.state.draggingText&&!(h(i,t.doc.sel.from)||h(t.doc.sel.to,i))){t.state.draggingText(n),setTimeout(nt(w,t),20);return}try{r=n.dataTransfer.getData("Text"),r&&(s=t.doc.sel.from,c=t.doc.sel.to,at(t.doc,i,i),t.state.draggingText&&lt(t.doc,"",s,c,"paste"),t.replaceSelection(r,null,"paste"),w(t),bt(t))}catch(n){}}}function ea(n,t){var r=n.display,f,u,e,i,o,s,h;try{f=t.clientX,u=t.clientY}catch(t){return!1}if(f>=Math.floor(l(r.gutters).right))return!1;if((a(t),!ki(n,"gutterClick"))||(e=l(r.lineDiv),u>e.bottom))return!0;for(u-=e.top-r.viewOffset,i=0;i<n.options.gutters.length;++i)if(o=r.gutters.childNodes[i],o&&l(o).right>=f){s=vf(n.doc,u),h=n.options.gutters[i],ut(n,"gutterClick",n,s,h,t);break}return!0}function oa(n,t){var u,r;ci(n.display,t)||(u=n.getSelection(),t.dataTransfer.setData("Text",u),t.dataTransfer.setDragImage&&!fe&&(r=i("img",null,null,"position: fixed; left: 0; top: 0;"),et&&(r.width=r.height=1,n.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),et&&r.parentNode.removeChild(r)))}function sr(n,t){Math.abs(n.doc.scrollTop-t)<2||(n.doc.scrollTop=t,ui||ou(n,[],t),n.display.scroller.scrollTop!=t&&(n.display.scroller.scrollTop=t),n.display.scrollbarV.scrollTop!=t&&(n.display.scrollbarV.scrollTop=t),ui&&ou(n,[]))}function li(n,t,i){(i?t==n.doc.scrollLeft:Math.abs(n.doc.scrollLeft-t)<2)||(t=Math.min(t,n.display.scroller.scrollWidth-n.display.scroller.clientWidth),n.doc.scrollLeft=t,cs(n),n.display.scroller.scrollLeft!=t&&(n.display.scroller.scrollLeft=t),n.display.scrollbarH.scrollLeft!=t&&(n.display.scrollbarH.scrollLeft=t))}function bs(n,t){var f=t.wheelDeltaX,u=t.wheelDeltaY,e,i,r;if(f==null&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(f=t.detail),u==null&&t.detail&&t.axis==t.VERTICAL_AXIS?u=t.detail:u==null&&(u=t.wheelDelta),u&&ei&&ft)for(e=t.target;e!=r;e=e.parentNode)if(e.lineObj){n.display.currentWheelTarget=e;break}if(i=n.display,r=i.scroller,f&&!ui&&!et&&b!=null){u&&sr(n,Math.max(0,Math.min(r.scrollTop+u*b,r.scrollHeight-r.clientHeight))),li(n,Math.max(0,Math.min(r.scrollLeft+f*b,r.scrollWidth-r.clientWidth))),a(t),i.wheelStartX=null;return}if(u&&b!=null){var s=u*b,o=n.doc.scrollTop,h=o+i.wrapper.clientHeight;s<0?o=Math.max(0,o+s-50):h=Math.min(n.doc.height,h+s+50),ou(n,[],{top:o,bottom:h})}hr<20&&(i.wheelStartX==null?(i.wheelStartX=r.scrollLeft,i.wheelStartY=r.scrollTop,i.wheelDX=f,i.wheelDY=u,setTimeout(function(){if(i.wheelStartX!=null){var n=r.scrollLeft-i.wheelStartX,t=r.scrollTop-i.wheelStartY,u=t&&i.wheelDY&&t/i.wheelDY||n&&i.wheelDX&&n/i.wheelDX;(i.wheelStartX=i.wheelStartY=null,u)&&(b=(b*hr+u)/(hr+1),++hr)}},200)):(i.wheelDX+=f,i.wheelDY+=u))}function bu(n,t,i){if(typeof t=="string"&&(t=ef[t],!t))return!1;n.display.pollingFast&&ke(n)&&(n.display.pollingFast=!1);var r=n.doc,f=r.sel.shift,u=!1;try{er(n)&&(n.state.suppressEdits=!0),i&&(r.sel.shift=!1),u=t(n)!=po}finally{r.sel.shift=f,n.state.suppressEdits=!1}return u}function ks(n){var t=n.state.keyMaps.slice(0);return t.push(n.options.keyMap),n.options.extraKeys&&t.unshift(n.options.extraKeys),t}function gs(n,t){var e=oo(n.options.keyMap),u=e.auto,r,i,f;return(clearTimeout(ds),u&&!ah(t)&&(ds=setTimeout(function(){oo(n.options.keyMap)==e&&(n.options.keyMap=u.call?u.call(null,n):u)},50)),r=vh(t,!0),i=!1,!r)?!1:(f=ks(n),i=t.shiftKey?ar("Shift-"+r,f,function(t){return bu(n,t,!0)})||ar(r,f,function(t){if(typeof t=="string"&&/^go[A-Z]/.test(t))return bu(n,t)}):ar(r,f,function(t){return bu(n,t)}),i=="stop"&&(i=!1),i&&(a(t),su(n),yt&&(t.oldKeyCode=t.keyCode,t.keyCode=0)),i)}function sa(n,t,i){var r=ar("'"+i+"'",ks(n),function(t){return bu(n,t,!0)});return r&&(a(t),su(n)),r}function nh(n){var t=this,i,r;(t.state.focused||bt(t),p&&n.keyCode==27&&(n.returnValue=!1),t.options.onKeyEvent&&t.options.onKeyEvent(t,nu(n)))||(i=n.keyCode,t.doc.sel.shift=i==16||n.shiftKey,r=gs(t,n),et&&(ku=r?i:null,r||i!=88||gc||!(ei?n.metaKey:n.ctrlKey)||t.replaceSelection("")))}function ha(n){var t=this,i,r,u;if(!t.options.onKeyEvent||!t.options.onKeyEvent(t,nu(n))){if(i=n.keyCode,r=n.charCode,et&&i==ku){ku=null,a(n);return}(et&&(!n.which||n.which<10)||ee)&&gs(t,n)||(u=String.fromCharCode(r==null?i:r),this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!er(this)&&this.doc.mode.electricChars.indexOf(u)>-1&&setTimeout(f(t,function(){nf(t,t.doc.sel.to.line,"smart")}),75),sa(t,n,u))||fr(t)}}function bt(n){n.options.readOnly!="nocursor"&&(n.state.focused||(g(n,"focus",n),n.state.focused=!0,n.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1&&(n.display.wrapper.className+=" CodeMirror-focused"),wt(n,!0)),yu(n),su(n))}function de(n){n.state.focused&&(g(n,"blur",n),n.state.focused=!1,n.display.wrapper.className=n.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(n.display.blinker),setTimeout(function(){n.state.focused||(n.doc.sel.shift=!1)},150)}function th(n,t){function a(){var u,e,t;i.inputDiv.style.position="relative",i.input.style.cssText=l,yt&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=c),yu(n),i.input.selectionStart!=null&&(!p||yt)&&(clearTimeout(ge),u=i.input.value=" "+(s(r.from,r.to)?"":i.input.value),e=0,i.prevInput=" ",i.input.selectionStart=1,i.input.selectionEnd=u.length,t=function(){i.prevInput==" "&&i.input.selectionStart==0?f(n,ef.selectAll)(n):e++<10?ge=setTimeout(t,500):wt(n)},ge=setTimeout(t,200))}var i=n.display,r=n.doc.sel,u,c,l,o;ci(i,t)||(u=or(n,t),c=i.scroller.scrollTop,u&&!et)&&((s(r.from,r.to)||h(u,r.from)||!h(u,r.to))&&f(n,at)(n.doc,u,u),l=i.input.style.cssText,i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.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);",w(n),wt(n,!0),s(r.from,r.to)&&(i.input.value=i.prevInput=" "),se?(bf(t),o=function(){st(window,"mouseup",o),setTimeout(a,20)},e(window,"mouseup",o)):setTimeout(a,50))}function no(n){return t(n.from.line+n.text.length-1,y(n.text).length+(n.text.length==1?n.from.ch:0))}function ih(n,i,f){var e,s,o,c;return h(i.from,f)?(e=i.text.length-1-(i.to.line-i.from.line),f.line>i.to.line+e)?(s=f.line-e,o=n.first+n.size-1,s>o)?t(o,r(n,o).text.length):du(f,r(n,s).text.length):f.line==i.to.line+e?du(f,y(i.text).length+(i.text.length==1?i.from.ch:0)+r(n,i.to.line).text.length-i.to.ch):(c=f.line-i.from.line,du(f,i.text[c].length+(c?0:i.from.ch))):u(n,f)}function to(n,i,r){var u,f;return r&&typeof r=="object"?{anchor:ih(n,i,r.anchor),head:ih(n,i,r.head)}:r=="start"?{anchor:i.from,head:i.from}:(u=no(i),r=="around")?{anchor:i.from,head:u}:r=="end"?{anchor:u,head:u}:(f=function(n){if(h(n,i.from))return n;if(!h(i.to,n))return u;var f=n.line+i.text.length-(i.to.line-i.from.line)-1,r=n.ch;return n.line==i.to.line&&(r+=u.ch-i.to.ch),t(f,r)},{anchor:f(n.sel.anchor),head:f(n.sel.head)})}function ca(n,t){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,update:function(t,i,r,f){t&&(this.from=u(n,t)),i&&(this.to=u(n,i)),r&&(this.text=r),f!==undefined&&(this.origin=f)},cancel:function(){this.canceled=!0}};return(g(n,"beforeChange",n,i),n.cm&&g(n.cm,"beforeChange",n.cm,i),i.canceled)?null:{from:i.from,to:i.to,text:i.text,origin:i.origin}}function cr(n,t,i,r){var u,e;if(n.cm){if(!n.cm.curOp)return f(n.cm,cr)(n,t,i,r);if(n.cm.state.suppressEdits)return}if(!ki(n,"beforeChange")&&(!n.cm||!ki(n.cm,"beforeChange"))||(t=ca(n,t),t))if(u=us&&!r&&ga(n,t.from,t.to),u){for(e=u.length-1;e>=1;--e)io(n,{from:u[e].from,to:u[e].to,text:[""]});u.length&&io(n,{from:u[0].from,to:u[0].to,text:t.text},i)}else io(n,t,i)}function io(n,t,i){var u=to(n,t,i),r;fv(n,t,u,n.cm?n.cm.curOp.id:NaN),lr(n,t,u,so(n,t)),r=[],wi(n,function(n,i){i||ht(r,n.history)!=-1||(cc(n.history,t),r.push(n.history)),lr(n,t,null,so(n,t))})}function rh(n,t){var u=n.history,i=(t=="undo"?u.done:u.undone).pop(),e,f,r,s,o;if(i)for(u.dirtyCounter+=t=="undo"?-1:1,e={changes:[],anchorBefore:i.anchorAfter,headBefore:i.headAfter,anchorAfter:i.anchorBefore,headAfter:i.headBefore},(t=="undo"?u.undone:u.done).push(e),f=i.changes.length-1;f>=0;--f)r=i.changes[f],r.origin=t,e.changes.push(vo(n,r)),s=f?to(n,r,null):{anchor:i.anchorBefore,head:i.headBefore},lr(n,r,s,yh(n,r)),o=[],wi(n,function(n,t){t||ht(o,n.history)!=-1||(cc(n.history,r),o.push(n.history)),lr(n,r,null,yh(n,r))})}function uh(n,i){function r(n){return t(n.line+i,n.ch)}n.first+=i,n.cm&&c(n.cm,n.first,n.first,i),n.sel.head=r(n.sel.head),n.sel.anchor=r(n.sel.anchor),n.sel.from=r(n.sel.from),n.sel.to=r(n.sel.to)}function lr(n,i,u,e){var s,o;if(n.cm&&!n.cm.curOp)return f(n.cm,lr)(n,i,u,e);if(i.to.line<n.first){uh(n,i.text.length-1-(i.to.line-i.from.line));return}i.from.line>n.lastLine()||(i.from.line<n.first&&(s=i.text.length-1-(n.first-i.from.line),uh(n,s),i={from:t(n.first,0),to:t(i.to.line+s,i.to.ch),text:[y(i.text)],origin:i.origin}),o=n.lastLine(),i.to.line>o&&(i={from:i.from,to:t(o,r(n,o).text.length),text:[i.text[0]],origin:i.origin}),u||(u=to(n,i,null)),n.cm?la(n.cm,i,e,u):lo(n,i,e,u))}function la(n,t,i,u){var f=n.doc,o=n.display,e=t.from,h=t.to,l=!1,a=e.line,y,v,s;if(n.options.lineWrapping||(a=d(yi(f,r(f,e.line))),f.iter(a,h.line+1,function(n){if(n==o.maxLine)return l=!0,!0})),lo(f,t,i,u,fs(n)),n.options.lineWrapping||(f.iter(a,e.line+t.text.length,function(n){var t=eu(f,n);t>o.maxLineLength&&(o.maxLine=n,o.maxLineLength=t,o.maxLineChanged=!0,l=!1)}),l&&(n.curOp.updateMaxLine=!0)),f.frontier=Math.min(f.frontier,e.line),hu(n,400),y=t.text.length-(h.line-e.line)-1,c(n,e.line,h.line+1,y),ki(n,"change"))if(v={from:e,to:h,text:t.text,origin:t.origin},n.curOp.textChanged){for(s=n.curOp.textChanged;s.next;s=s.next);s.next=v}else n.curOp.textChanged=v}function lt(n,t,i,r,u){if(r||(r=i),h(r,i)){var f=r;r=i,i=f}typeof t=="string"&&(t=ii(t)),cr(n,{from:i,to:r,text:t,origin:u},null)}function t(n,i){if(!(this instanceof t))return new t(n,i);this.line=n,this.ch=i}function s(n,t){return n.line==t.line&&n.ch==t.ch}function h(n,t){return n.line<t.line||n.line==t.line&&n.ch<t.ch}function kt(n){return t(n.line,n.ch)}function fh(n,t){return Math.max(n.first,Math.min(t,n.first+n.size-1))}function u(n,i){if(i.line<n.first)return t(n.first,0);var u=n.first+n.size-1;return i.line>u?t(u,r(n,u).text.length):du(i,r(n,i.line).text.length)}function du(n,i){var r=n.ch;return r==null||r>i?t(n.line,i):r<0?t(n.line,0):n}function dt(n,t){return t>=n.first&&t<n.first+n.size}function v(n,t,i,r){var u,f;n.sel.shift||n.sel.extend?(u=n.sel.anchor,i&&(f=h(t,u),f!=h(i,u)?(u=t,t=i):f!=h(t,i)&&(t=i)),at(n,u,t,r)):at(n,t,i||t,r),n.cm&&(n.cm.curOp.userSelChange=!0)}function aa(n,t,i){var r={anchor:t,head:i};return g(n,"beforeSelectionChange",n,r),n.cm&&g(n.cm,"beforeSelectionChange",n.cm,r),r.anchor=u(n,r.anchor),r.head=u(n,r.head),r}function at(n,t,i,r,u){var e,f,o;((!u&&ki(n,"beforeSelectionChange")||n.cm&&ki(n.cm,"beforeSelectionChange"))&&(e=aa(n,t,i),i=e.head,t=e.anchor),f=n.sel,f.goalColumn=null,(u||!s(t,f.anchor))&&(t=gu(n,t,r,u!="push")),(u||!s(i,f.head))&&(i=gu(n,i,r,u!="push")),s(f.anchor,t)&&s(f.head,i))||(f.anchor=t,f.head=i,o=h(i,t),f.from=o?i:t,f.to=o?t:i,n.cm&&(n.cm.curOp.updateInput=n.cm.curOp.selectionChanged=!0),ut(n,"cursorActivity",n))}function eh(n){at(n.doc,n.doc.sel.from,n.doc.sel.to,null,"push")}function gu(n,i,f,e){var w=!1,c=i,p=f||1,v,y,l,a,o,h;n.cantEdit=!1;n:for(;;){if(v=r(n,c.line),v.markedSpans){for(h=0;h<v.markedSpans.length;++h)if(l=v.markedSpans[h],a=l.marker,(l.from==null||(a.inclusiveLeft?l.from<=c.ch:l.from<c.ch))&&(l.to==null||(a.inclusiveRight?l.to>=c.ch:l.to>c.ch))){if(e&&a.clearOnEnter){(y||(y=[])).push(a);continue}else if(!a.atomic)continue;if(o=a.find()[p<0?"from":"to"],s(o,c)&&(o.ch+=p,o.ch<0?o=o.line>n.first?u(n,t(o.line-1)):null:o.ch>v.text.length&&(o=o.line<n.first+n.size-1?t(o.line+1,0):null),!o)){if(w)return e?(n.cantEdit=!0,t(n.first,0)):gu(n,i,f,!0);w=!0,o=i,p=-p}c=o;continue n}if(y)for(h=0;h<y.length;++h)y[h].clear()}return c}}function va(n){var i=oh(n,n.doc.sel.head),u;if(n.state.focused){var t=n.display,f=l(t.sizer),r=null;i.top+f.top<0?r=!0:i.bottom+f.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),r==null||el||(u=t.cursor.style.display=="none",u&&(t.cursor.style.display="",t.cursor.style.left=i.left+"px",t.cursor.style.top=i.top-t.viewOffset+"px"),t.cursor.scrollIntoView(r),u&&(t.cursor.style.display="none"))}}function oh(n,t){for(;;){var u=!1,i=ot(n,t),r=ro(n,i.left,i.top,i.left,i.bottom),f=n.doc.scrollTop,e=n.doc.scrollLeft;if(r.scrollTop!=null&&(sr(n,r.scrollTop),Math.abs(n.doc.scrollTop-f)>1&&(u=!0)),r.scrollLeft!=null&&(li(n,r.scrollLeft),Math.abs(n.doc.scrollLeft-e)>1&&(u=!0)),!u)return i}}function sh(n,t,i,r,u){var f=ro(n,t,i,r,u);f.scrollTop!=null&&sr(n,f.scrollTop),f.scrollLeft!=null&&li(n,f.scrollLeft)}function ro(n,t,i,r,u){var f=n.display,e=cu(f),h,c,s,l;i+=e,u+=e;var a=f.scroller.clientHeight-di,v=f.scroller.scrollTop,o={},y=n.doc.height+2*e,p=i<e+10,w=u+e>y-10;return i<v?o.scrollTop=p?0:Math.max(0,i):u>v+a&&(o.scrollTop=(w?y:u)-a),h=f.scroller.clientWidth-di,c=f.scroller.scrollLeft,t+=f.gutters.offsetWidth,r+=f.gutters.offsetWidth,s=f.gutters.offsetWidth,l=t<s+10,t<c+s||l?(l&&(t=0),o.scrollLeft=Math.max(0,t-10-s)):r>h+c-3&&(o.scrollLeft=r+10-h),o}function nf(n,i,u,f){var l=n.doc,y,s,c,v;u||(u="add"),u=="smart"&&(n.doc.mode.indent?y=rr(n,i):u="prev");var h=n.options.tabSize,o=r(l,i),p=gi(o.text,null,h),a=o.text.match(/^\s*/)[0],e;if(u=="smart"&&(e=n.doc.mode.indent(y,o.text.slice(a.length),o.text),e==po)){if(!f)return;u="prev"}if(u=="prev"?e=i>l.first?gi(r(l,i-1).text,null,h):0:u=="add"?e=p+n.options.indentUnit:u=="subtract"&&(e=p-n.options.indentUnit),e=Math.max(0,e),s="",c=0,n.options.indentWithTabs)for(v=Math.floor(e/h);v;--v)c+=h,s+="\t";c<e&&(s+=vc(e-c)),s!=a&&lt(n.doc,s,t(i,0),t(i,a.length),"+input"),o.stateAfter=null}function tf(n,t,i){var u=t,f=t,e=n.doc;if(typeof t=="number"?f=r(e,fh(e,t)):u=d(t),u==null)return null;if(i(f,u))c(n,u,u+1);else return null;return f}function uo(n,i,u,f,e){function y(){var t=c+u;return t<n.first||t>=n.first+n.size?l=!1:(c=t,s=r(n,t))}function h(n){var t=(e?ts:tl)(s,o,u,!0);if(t==null)if(!n&&y())o=e?(u<0?ue:re)(s):u<0?s.text.length:0;else return l=!1;else o=t;return!0}var c=i.line,o=i.ch,s=r(n,c),l=!0,a,v;if(f=="char")h();else if(f=="column")h(!0);else if(f=="word")for(a=!1;;){if(u<0&&!h())break;if(df(s.text.charAt(o)))a=!0;else if(a){u<0&&(u=1,h());break}if(u>0&&!h())break}return v=gu(n,t(c,o),u,!0),l||(v.hitSide=!0),v}function hh(n,t,i,r){var o=n.doc,s=t.left,u,e,f;for(r=="page"?(e=Math.min(n.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=t.top+i*e):r=="line"&&(u=i>0?t.bottom+3:t.top-3);;){if(f=be(n,s,u),!f.outside)break;if(i<0?u<=0:u>=o.height){f.hitSide=!0;break}u+=i*5}return f}function ch(n,i){var r=i.ch,u=i.ch,f,e;if(n){for(i.after===!1||u==n.length?--r:++u,f=n.charAt(r),e=df(f)?df:/\s/.test(f)?function(n){return/\s/.test(n)}:function(n){return!/\s/.test(n)&&!df(n)};r>0&&e(n.charAt(r-1));)--r;while(u<n.length&&e(n.charAt(u)))++u}return{from:t(i.line,r),to:t(i.line,u)}}function ya(n,i){v(n.doc,t(i,0),u(n.doc,t(i+1,0)))}function o(t,i,r,u){n.defaults[t]=i,r&&(gt[t]=u?function(n,t,i){i!=fo&&r(n,t,i)}:r)}function vi(n,t){var r,u,i;if(t===!0)return t;if(n.copyState)return n.copyState(t);r={};for(u in t)i=t[u],i instanceof Array&&(i=i.concat([])),r[u]=i;return r}function lh(n,t,i){return n.startState?n.startState(t,i):!0}function oo(n){return typeof n=="string"?tt[n]:n}function ar(n,t,i){function u(t){var f,r,e,s,o;if(t=oo(t),f=t[n],f===!1)return"stop";if(f!=null&&i(f))return!0;if(t.nofallthrough)return"stop";if(r=t.fallthrough,r==null)return!1;if(Object.prototype.toString.call(r)!="[object Array]")return u(r);for(e=0,s=r.length;e<s;++e)if(o=u(r[e]),o)return o;return!1}for(var f,r=0;r<t.length;++r)if(f=u(t[r]),f)return f}function ah(n){var t=ri[n.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function vh(n,t){var i=ri[n.keyCode];return i==null||n.altGraphKey?!1:(n.altKey&&(i="Alt-"+i),(rs?n.metaKey:n.ctrlKey)&&(i="Ctrl-"+i),(rs?n.ctrlKey:n.metaKey)&&(i="Cmd-"+i),!t&&n.shiftKey&&(i="Shift-"+i),i)}function vr(n,t){this.pos=this.start=0,this.string=n,this.tabSize=t||8}function ni(n,t){this.lines=[],this.type=t,this.doc=n}function yr(n,t,r,u,e){var o;if(u&&u.shared)return pa(n,t,r,u,e);if(n.cm&&!n.cm.curOp)return f(n.cm,yr)(n,t,r,u,e);if(o=new ni(n,e),e=="range"&&!h(t,r))return o;u&&kf(u,o),o.replacedWith&&(o.collapsed=!0,o.replacedWith=i("span",[o.replacedWith],"CodeMirror-widget")),o.collapsed&&(tr=!0);var l=t.line,a=0,v,y,s=n.cm,p;if(n.iter(l,r.line+1,function(i){s&&o.collapsed&&!s.options.lineWrapping&&yi(n,i)==s.display.maxLine&&(p=!0);var u={from:null,to:null,marker:o};a+=i.text.length,l==t.line&&(u.from=t.ch,a-=t.ch),l==r.line&&(u.to=r.ch,a-=i.text.length-r.ch),o.collapsed&&(l==r.line&&(y=of(i,r.ch)),l==t.line?v=of(i,t.ch):it(i,0)),ba(i,u),++l}),o.collapsed&&n.iter(t.line,r.line+1,function(t){ti(n,t)&&it(t,0)}),o.readOnly&&(us=!0,(n.history.done.length||n.history.undone.length)&&n.clearHistory()),o.collapsed){if(v!=y)throw new Error("Inserting collapsed marker overlapping an existing one");o.size=a,o.atomic=!0}return s&&(p&&(s.curOp.updateMaxLine=!0),(o.className||o.startStyle||o.endStyle||o.collapsed)&&c(s,t.line,r.line+1),o.atomic&&eh(s)),o}function pr(n,t){this.markers=n,this.primary=t;for(var i=0,r=this;i<n.length;++i)n[i].parent=this,e(n[i],"clear",function(){r.clear()})}function pa(n,t,i,r,f){r=kf(r),r.shared=!1;var e=[yr(n,t,i,r,f)],o=e[0];return wi(n,function(n){e.push(yr(n,u(n,t),u(n,i),r,f));for(var s=0;s<n.linked.length;++s)if(n.linked[s].isParent)return;o=y(e)}),new pr(e,o)}function wr(n,t){var i,r;if(n)for(i=0;i<n.length;++i)if(r=n[i],r.marker==t)return r}function wa(n,t){for(var r,i=0;i<n.length;++i)n[i]!=t&&(r||(r=[])).push(n[i]);return r}function ba(n,t){n.markedSpans=n.markedSpans?n.markedSpans.concat([t]):[t],t.marker.attachLine(n)}function ka(n,t,i){var u,e,o;if(n)for(u=0;u<n.length;++u){var r=n[u],f=r.marker,s=r.from==null||(f.inclusiveLeft?r.from<=t:r.from<t);!s&&(f.type!="bookmark"||r.from!=t||i&&r.marker.insertLeft)||(o=r.to==null||(f.inclusiveRight?r.to>=t:r.to>t),(e||(e=[])).push({from:r.from,to:o?null:r.to,marker:f}))}return e}function da(n,t,i){var u,e,o;if(n)for(u=0;u<n.length;++u){var r=n[u],f=r.marker,s=r.to==null||(f.inclusiveRight?r.to>=t:r.to>t);(s||f.type=="bookmark"&&r.from==t&&(!i||r.marker.insertLeft))&&(o=r.from==null||(f.inclusiveLeft?r.from<=t:r.from<t),(e||(e=[])).push({from:o?null:r.from-t,to:r.to==null?null:r.to-t,marker:f}))}return e}function so(n,t){var w=dt(n,t.from.line)&&r(n,t.from.line).markedSpans,b=dt(n,t.to.line)&&r(n,t.to.line).markedSpans,u,e,l,v,p,i;if(!w&&!b)return null;var a=t.from.ch,d=t.to.ch,k=s(t.from,t.to),f=ka(w,a,k),o=da(b,d,k),h=t.text.length==1,c=y(t.text).length+(h?a:0);if(f)for(i=0;i<f.length;++i)u=f[i],u.to==null&&(e=wr(o,u.marker),e?h&&(u.to=e.to==null?null:e.to+c):u.to=a);if(o)for(i=0;i<o.length;++i)u=o[i],u.to!=null&&(u.to+=c),u.from==null?(e=wr(f,u.marker),e||(u.from=c,h&&(f||(f=[])).push(u))):(u.from+=c,h&&(f||(f=[])).push(u));if(l=[f],!h){if(v=t.text.length-2,v>0&&f)for(i=0;i<f.length;++i)f[i].to==null&&(p||(p=[])).push({from:null,to:null,marker:f[i].marker});for(i=0;i<v;++i)l.push(p);l.push(o)}return l}function yh(n,t){var i=ov(n,t),s=so(n,t),r,f,u,e,h,o;if(!i)return s;if(!s)return i;for(r=0;r<i.length;++r)if(f=i[r],u=s[r],f&&u)n:for(e=0;e<u.length;++e){for(h=u[e],o=0;o<f.length;++o)if(f[o].marker==h.marker)continue n;f.push(h)}else u&&(i[r]=u);return i}function ga(n,t,i){var f=null,e,l,a,r,o,u,c;if(n.iter(t.line,i.line+1,function(n){var t,i;if(n.markedSpans)for(t=0;t<n.markedSpans.length;++t)i=n.markedSpans[t].marker,i.readOnly&&(!f||ht(f,i)==-1)&&(f||(f=[])).push(i)}),!f)return null;for(e=[{from:t,to:i}],l=0;l<f.length;++l)for(a=f[l],r=a.find(),o=0;o<e.length;++o)(u=e[o],h(u.to,r.from)||h(r.to,u.from))||(c=[o,1],(h(u.from,r.from)||!a.inclusiveLeft&&s(u.from,r.from))&&c.push({from:u.from,to:r.from}),(h(r.to,u.to)||!a.inclusiveRight&&s(u.to,r.to))&&c.push({from:r.to,to:u.to}),e.splice.apply(e,c),o+=c.length-1);return e}function of(n,t){var f=tr&&n.markedSpans,r,i,u;if(f)for(u=0;u<f.length;++u)(i=f[u],i.marker.collapsed)&&(i.from==null||i.from<t)&&(i.to==null||i.to>t)&&(!r||r.width<i.marker.width)&&(r=i.marker);return r}function sf(n){return of(n,-1)}function br(n){return of(n,n.text.length+1)}function yi(n,t){for(var i;i=sf(t);)t=r(n,i.find().from.line);return t}function ti(n,t){var u=tr&&t.markedSpans,i,r;if(u)for(r=0;r<u.length;++r)if((i=u[r],i.marker.collapsed)&&(i.from==null||i.from==0&&i.marker.inclusiveLeft&&ho(n,t,i)))return!0}function ho(n,t,i){var o,e,u,f;if(i.to==null)return o=i.marker.find().to,e=r(n,o.line),ho(n,e,wr(e.markedSpans,i.marker));if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(f=0;f<t.markedSpans.length;++f)if(u=t.markedSpans[f],u.marker.collapsed&&u.from==i.to&&(u.marker.inclusiveLeft||i.marker.inclusiveRight)&&ho(n,t,u))return!0}function ph(n){var i=n.markedSpans,t;if(i){for(t=0;t<i.length;++t)i[t].marker.detachLine(n);n.markedSpans=null}}function wh(n,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(n);n.markedSpans=t}}function bh(n){return function(){var t=!this.cm.curOp,i;t&&si(this.cm);try{i=n.apply(this,arguments)}finally{t&&hi(this.cm)}return i}}function cf(n){return n.height!=null?n.height:(n.node.parentNode&&n.node.parentNode.nodeType==1||ct(n.cm.display.measure,i("div",[n.node],null,"position: relative")),n.height=n.node.offsetHeight)}function nv(n,t,i,r){var u=new hf(n,i,r);return u.noHScroll&&(n.display.alignWidgets=!0),tf(n,t,function(t){if((t.widgets||(t.widgets=[])).push(u),u.line=t,!ti(n.doc,t)||u.showIfHidden){var i=bi(n,t)<n.display.scroller.scrollTop;it(t,t.height+cf(u)),i&&(n.curOp.updateScrollPos={scrollTop:n.doc.scrollTop+u.height,scrollLeft:n.doc.scrollLeft})}return!0}),u}function kr(n,t,i){var r={text:n};return wh(r,t),r.height=i?i(r):1,r}function pi(n,t,i,r){n.text=t,n.stateAfter&&(n.stateAfter=null),n.styles&&(n.styles=null),n.order!=null&&(n.order=null),ph(n),wh(n,i);var u=r?r(n):1;u!=n.height&&it(n,u),ut(n,"change")}function tv(n){n.parent=null,ph(n)}function kh(n,t,i,r,u){var c=n.options.flattenSpans,e="",o=null,f=new vr(t,n.options.tabSize),s,h;for(t==""&&i.blankLine&&i.blankLine(r);!f.eol();)s=i.token(f,r),f.pos>5e3&&(c=!1,f.pos=Math.min(t.length,f.start+5e4),s=null),h=f.current(),f.start=f.pos,c&&o==s?e=e+h:(e&&u(e,o),e=h,o=s);e&&u(e,o)}function dh(n,t,i){var u=[n.state.modeGen],f,e,r;for(kh(n,t.text,n.doc.mode,i,function(n,t){u.push(n,t)}),f=0;f<n.state.overlays.length;++f)e=n.state.overlays[f],r=1,kh(n,t.text,e.mode,!0,function(n,t){for(var f=r,o=n.length,s,i;o;)i=u[r],s=i.length,s<=o?o-=s:(u.splice(r,1,i.slice(0,o),u[r+1],i.slice(o)),o=0),r+=2;if(t)if(e.opaque)u.splice(f,r-f,n,t),r=f+2;else for(;f<r;f+=2)i=u[f+1],u[f+1]=i?i+" "+t:t});return u}function iv(n,t){return t.styles&&t.styles[0]==n.state.modeGen||(t.styles=dh(n,t,t.stateAfter=rr(n,d(t)))),t.styles}function gh(n,t,i){var u=n.doc.mode,r=new vr(t.text,n.options.tabSize);for(t.text==""&&u.blankLine&&u.blankLine(i);!r.eol()&&r.pos<=5e3;)u.token(r,i),r.start=r.pos}function nc(n){return n?co[n]||(co[n]="cm-"+n.replace(/ +/g," cm-")):null}function tc(n,t,u){for(var w,e=t,a,b,v=!0,f,c,o,s,l,y,h;w=sf(e);)v=!1,e=r(n.doc,w.find().from.line),a||(a=e);f={pre:i("pre"),col:0,pos:0,display:!u,measure:null,addedOne:!1,cm:n},e.textClass&&(f.pre.className=e.textClass);do f.measure=e==t&&u,f.pos=0,f.addToken=f.measure?rv:ic,u&&b&&e!=t&&!f.addedOne&&(u[0]=f.pre.appendChild(ko(n.display.measure)),f.addedOne=!0),c=uv(e,f,iv(n,e)),b=e==a,c&&(e=r(n.doc,c.to.line),v=!1);while(c);return u&&!f.addedOne&&(u[0]=f.pre.appendChild(v?i("span"," "):ko(n.display.measure))),f.pre.firstChild||ti(n.doc,t)||f.pre.appendChild(document.createTextNode(" ")),u&&p&&(o=rt(e))&&(s=o.length-1,o[s].from==o[s].to&&--s,l=o[s],y=o[s-1],l.from+1==l.to&&y&&l.level<y.level&&(h=u[f.pos-1],h&&h.parentNode.insertBefore(h.measureRight=ko(n.display.measure),h.nextSibling))),f.pre}function ic(n,t,r,u,f){var e,o,s,h,l,a,v,c;if(t){if(lf.test(t))for(e=document.createDocumentFragment(),o=0;;){if(lf.lastIndex=o,s=lf.exec(t),h=s?s.index-o:t.length-o,h&&(e.appendChild(document.createTextNode(t.slice(o,o+h))),n.col+=h),!s)break;o+=h+1,s[0]=="\t"?(l=n.cm.options.tabSize,a=l-n.col%l,e.appendChild(i("span",vc(a),"cm-tab")),n.col+=a):(v=i("span","•","cm-invalidchar"),v.title="\\u"+s[0].charCodeAt(0).toString(16),e.appendChild(v),n.col+=1)}else n.col+=t.length,e=document.createTextNode(t);if(r||u||f||n.measure)return c=r||"",u&&(c+=u),f&&(c+=f),n.pre.appendChild(i("span",[e],c));n.pre.appendChild(e)}}function rv(n,t,r,u,f){for(var o,s,e=0;e<t.length;++e)o=t.charAt(e),s=e==0,o>="�"&&o<"�"&&e<t.length-1?(o=t.slice(e,e+2),++e):e&&n.cm.options.lineWrapping&&ru.test(t.slice(e-1,e+1))&&n.pre.appendChild(i("wbr")),n.measure[n.pos]=ic(n,o,r,s&&u,e==t.length-1&&f),n.pos+=o.length;t.length&&(n.addedOne=!0)}function rc(n,t,i){i&&(n.display||(i=i.cloneNode(!0)),n.pre.appendChild(i),n.measure&&t&&(n.measure[n.pos]=i,n.addedOne=!0)),n.pos+=t}function uv(n,t,i){var b=n.markedSpans,s,y,p,u,e,c,w,g;if(!b){for(s=1;s<i.length;s+=2)t.addToken(t,i[s],nc(i[s+1]));return}for(var nt=n.text,k=nt.length,r=0,s=1,h="",d,o=0,l,a,v,f;;){if(o==r){for(l=a=v="",f=null,o=Infinity,y=null,p=0;p<b.length;++p)u=b[p],e=u.marker,u.from<=r&&(u.to==null||u.to>r)?(u.to!=null&&o>u.to&&(o=u.to,a=""),e.className&&(l+=" "+e.className),e.startStyle&&u.from==r&&(v+=" "+e.startStyle),e.endStyle&&u.to==o&&(a+=" "+e.endStyle),e.collapsed&&(!f||f.marker.width<e.width)&&(f=u)):u.from>r&&o>u.from&&(o=u.from),e.type=="bookmark"&&u.from==r&&e.replacedWith&&(y=e.replacedWith);if(f&&(f.from||0)==r&&(rc(t,(f.to==null?k:f.to)-r,f.from!=null&&f.marker.replacedWith),f.to==null))return f.marker.find();y&&!f&&rc(t,0,y)}if(r>=k)break;for(c=Math.min(k,o);;){if(h){if(w=r+h.length,f||(g=w>c?h.slice(0,c-r):h,t.addToken(t,g,d?d+l:l,v,r+g.length==o?a:"")),w>=c){h=h.slice(c-r),r=c;break}r=w,v=""}h=i[s++],d=nc(i[s++])}}}function lo(n,t,i,u,f){function l(n){return i?i[n]:null}var o=t.from,a=t.to,s=t.text,h=r(n,o.line),v=r(n,a.line),b=y(s),k=l(s.length-1),p=a.line-o.line;if(o.ch==0&&a.ch==0&&b==""){for(var e=0,w=s.length-1,c=[];e<w;++e)c.push(kr(s[e],l(e),f));pi(v,v.text,k,f),p&&n.remove(o.line,p),c.length&&n.insert(o.line,c)}else if(h==v)if(s.length==1)pi(h,h.text.slice(0,o.ch)+b+h.text.slice(a.ch),k,f);else{for(var c=[],e=1,w=s.length-1;e<w;++e)c.push(kr(s[e],l(e),f));c.push(kr(b+h.text.slice(a.ch),k,f)),pi(h,h.text.slice(0,o.ch)+s[0],l(0),f),n.insert(o.line+1,c)}else if(s.length==1)pi(h,h.text.slice(0,o.ch)+s[0]+v.text.slice(a.ch),l(0),f),n.remove(o.line+1,p);else{pi(h,h.text.slice(0,o.ch)+s[0],l(0),f),pi(v,b+v.text.slice(a.ch),k,f);for(var e=1,w=s.length-1,c=[];e<w;++e)c.push(kr(s[e],l(e),f));p>1&&n.remove(o.line+1,p-1),n.insert(o.line+1,c)}ut(n,"change",n,t),at(n,u.anchor,u.head,null,!0)}function af(n){this.lines=n,this.parent=null;for(var t=0,r=n.length,i=0;t<r;++t)n[t].parent=this,i+=n[t].height;this.height=i}function dr(n){var r,u,t,f,i;for(this.children=n,r=0,u=0,t=0,f=n.length;t<f;++t)i=n[t],r+=i.chunkSize(),u+=i.height,i.parent=this;this.size=r,this.height=u,this.parent=null}function wi(n,t,i){function r(n,u,f){var o,e,s;if(n.linked)for(o=0;o<n.linked.length;++o)(e=n.linked[o],e.doc!=u)&&(s=f&&e.sharedHist,!i||s)&&(t(e.doc,s),r(e.doc,n,s))}r(n,null,!0)}function ec(n,t){if(t.cm)throw new Error("This document is already in use.");n.doc=t,t.cm=n,es(n),fu(n),n.options.lineWrapping||he(n),n.options.mode=t.modeOption,c(n)}function r(n,t){var i,r,u;for(t-=n.first;!n.lines;)for(i=0;;++i){if(r=n.children[i],u=r.chunkSize(),t<u){n=r;break}t-=u}return n.lines[t]}function oc(n,t,i){var u=[],r=t.line;return n.iter(t.line,i.line+1,function(n){var f=n.text;r==i.line&&(f=f.slice(0,i.ch)),r==t.line&&(f=f.slice(t.ch)),u.push(f),++r}),u}function ao(n,t,i){var r=[];return n.iter(t,i,function(n){r.push(n.text)}),r}function it(n,t){for(var r=t-n.height,i=n;i;i=i.parent)i.height+=r}function d(n){var i,u,t,r;if(n.parent==null)return null;for(i=n.parent,u=ht(i.lines,n),t=i.parent;t;i=t,t=t.parent)for(r=0;;++r){if(t.children[r]==i)break;u+=t.children[r].chunkSize()}return u+i.first}function vf(n,t){var f=n.first,u,e,i,r,s,o;n:do{for(i=0,r=n.children.length;i<r;++i){if(u=n.children[i],e=u.height,t<e){n=u;continue n}t-=e,f+=u.chunkSize()}return f}while(!n.lines);for(i=0,r=n.lines.length;i<r;++i){if(s=n.lines[i],o=s.height,t<o)break;t-=o}return f+i}function bi(n,t){var f,r,e,u,i,o;for(t=yi(n.doc,t),f=0,r=t.parent,i=0;i<r.lines.length;++i)if(e=r.lines[i],e==t)break;else f+=e.height;for(u=r.parent;u;r=u,u=r.parent)for(i=0;i<u.children.length;++i)if(o=u.children[i],o==r)break;else f+=o.height;return f}function rt(n){var t=n.order;return t==null&&(t=n.order=il(n.text)),t}function yf(){return{done:[],undone:[],undoDepth:Infinity,lastTime:0,lastOp:null,lastOrigin:null,dirtyCounter:0}}function sc(n,t,i,r){var u=t["spans_"+n.id],f=0;n.iter(Math.max(n.first,i),Math.min(n.first+n.size,r),function(i){i.markedSpans&&((u||(u=t["spans_"+n.id]={}))[f]=i.markedSpans),++f})}function vo(n,t){var i={from:t.from,to:no(t),text:oc(n,t.from,t.to)};return sc(n,i,t.from.line,t.to.line+1),wi(n,function(n){sc(n,i,t.from.line,t.to.line+1)},!0),i}function fv(n,t,i,r){var u=n.history,e,f,o;if(u.undone.length=0,e=+new Date,f=y(u.done),f&&(u.lastOp==r||u.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&u.lastTime>e-600||t.origin.charAt(0)=="*")))o=y(f.changes),s(t.from,t.to)&&s(t.from,o.to)?o.to=no(t):f.changes.push(vo(n,t)),f.anchorAfter=i.anchor,f.headAfter=i.head;else{for(f={changes:[vo(n,t)],anchorBefore:n.sel.anchor,headBefore:n.sel.head,anchorAfter:i.anchor,headAfter:i.head},u.done.push(f);u.done.length>u.undoDepth;)u.done.shift();u.dirtyCounter<0?u.dirtyCounter=NaN:u.dirtyCounter++}u.lastTime=e,u.lastOp=r,u.lastOrigin=t.origin}function ev(n){if(!n)return null;for(var i=0,t;i<n.length;++i)n[i].marker.explicitlyCleared?t||(t=n.slice(0,i)):t&&t.push(n[i]);return t?t.length?t:null:n}function ov(n,t){var u=t["spans_"+n.id],i,r;if(!u)return null;for(i=0,r=[];i<t.text.length;++i)r.push(ev(u[i]));return r}function pf(n,t){for(var e,i,c,u,f=0,o=[];f<n.length;++f){var r=n[f],h=r.changes,s=[];for(o.push({changes:s,anchorBefore:r.anchorBefore,headBefore:r.headBefore,anchorAfter:r.anchorAfter,headAfter:r.headAfter}),e=0;e<h.length;++e)if(i=h[e],s.push({from:i.from,to:i.to,text:i.text}),t)for(u in i)(c=u.match(/^spans_(\d+)$/))&&ht(t,Number(c[1]))>-1&&(y(s)[u]=i[u],delete i[u])}return o}function wf(n,t,i,r){i<n.line?n.line+=r:t<n.line&&(n.line=t,n.ch=0)}function hc(n,t,i,r){for(var u,s,o,f,e=0;e<n.length;++e){for(u=n[e],s=!0,o=0;o<u.changes.length;++o)if(f=u.changes[o],u.copied||(f.from=kt(f.from),f.to=kt(f.to)),i<f.from.line)f.from.line+=r,f.to.line+=r;else if(t<=f.to.line){s=!1;break}u.copied||(u.anchorBefore=kt(u.anchorBefore),u.headBefore=kt(u.headBefore),u.anchorAfter=kt(u.anchorAfter),u.readAfter=kt(u.headAfter),u.copied=!0),s?(wf(u.anchorBefore),wf(u.headBefore),wf(u.anchorAfter),wf(u.headAfter)):(n.splice(0,e+1),e=0)}}function cc(n,t){var i=t.from.line,r=t.to.line,u=t.text.length-(r-i)-1;hc(n.done,i,r,u),hc(n.undone,i,r,u)}function sv(){bf(this)}function nu(n){return n.stop||(n.stop=sv),n}function a(n){n.preventDefault?n.preventDefault():n.returnValue=!1}function lc(n){n.stopPropagation?n.stopPropagation():n.cancelBubble=!0}function bf(n){a(n),lc(n)}function yo(n){return n.target||n.srcElement}function ac(n){var t=n.which;return t==null&&(n.button&1?t=1:n.button&2?t=3:n.button&4&&(t=2)),ei&&n.ctrlKey&&t==1&&(t=3),t}function e(n,t,i){if(n.addEventListener)n.addEventListener(t,i,!1);else if(n.attachEvent)n.attachEvent("on"+t,i);else{var r=n._handlers||(n._handlers={}),u=r[t]||(r[t]=[]);u.push(i)}}function st(n,t,i){var r,u;if(n.removeEventListener)n.removeEventListener(t,i,!1);else if(n.detachEvent)n.detachEvent("on"+t,i);else{if(r=n._handlers&&n._handlers[t],!r)return;for(u=0;u<r.length;++u)if(r[u]==i){r.splice(u,1);break}}}function g(n,t){var r=n._handlers&&n._handlers[t],u,i;if(r)for(u=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,u)}function ut(n,t){function f(n){return function(){n.apply(null,u)}}var r=n._handlers&&n._handlers[t],u,i;if(r)for(u=Array.prototype.slice.call(arguments,2),vt||(++tu,vt=[],setTimeout(hv,0)),i=0;i<r.length;++i)vt.push(f(r[i]))}function hv(){var t,n;for(--tu,t=vt,vt=null,n=0;n<t.length;++n)t[n]()}function ki(n,t){var i=n._handlers&&n._handlers[t];return i&&i.length>0}function wo(){this.id=null}function gi(n,t,i){t==null&&(t=n.search(/[^\s\u00a0]/),t==-1&&(t=n.length));for(var u=0,r=0;u<t;++u)n.charAt(u)=="\t"?r+=i-r%i:++r;return r}function vc(n){while(iu.length<=n)iu.push(y(iu)+" ");return iu[n]}function y(n){return n[n.length-1]}function yc(n){uu?(n.selectionStart=0,n.selectionEnd=n.value.length):n.select()}function ht(n,t){if(n.indexOf)return n.indexOf(t);for(var i=0,r=n.length;i<r;++i)if(n[i]==t)return i;return-1}function cv(n,t){function i(){}i.prototype=n;var r=new i;return t&&kf(t,r),r}function kf(n,t){t||(t={});for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i]);return t}function pc(n){for(var t=[],i=0;i<n;++i)t.push(undefined);return t}function nt(n){var t=Array.prototype.slice.call(arguments,1);return function(){return n.apply(null,t)}}function df(n){return/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||wc.test(n))}function bc(n){for(var t in n)if(n.hasOwnProperty(t)&&n[t])return!1;return!0}function i(n,t,i,r){var u=document.createElement(n),f;if(i&&(u.className=i),r&&(u.style.cssText=r),typeof t=="string")kc(u,t);else if(t)for(f=0;f<t.length;++f)u.appendChild(t[f]);return u}function ne(n){if(p)while(n.firstChild)n.removeChild(n.firstChild);else n.innerHTML="";return n}function ct(n,t){return ne(n).appendChild(t)}function kc(n,t){yt?(n.innerHTML="",n.appendChild(document.createTextNode(t))):n.textContent=t}function l(n){return n.getBoundingClientRect()}function ie(n){if(te!=null)return te;var t=i("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return ct(n,t),t.offsetWidth&&(te=t.offsetHeight-t.clientHeight),te||0}function ko(n){if(bo==null){var t=i("span","​");ct(n,i("span",[t,document.createTextNode("x")])),n.firstChild.offsetHeight!=0&&(bo=t.offsetWidth<=1&&t.offsetHeight>2&&!fi)}return bo?i("span","​"):i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function av(n,t,i,r){var f,u;if(!n)return r(t,i,"ltr");for(f=0;f<n.length;++f)u=n[f],(u.from<i&&u.to>t||t==i&&u.to==t)&&r(Math.max(u.from,t),Math.min(u.to,i),u.level==1?"rtl":"ltr")}function go(n){return n.level%2?n.to:n.from}function ns(n){return n.level%2?n.from:n.to}function re(n){var t=rt(n);return t?go(t[0]):0}function ue(n){var t=rt(n);return t?ns(y(t)):n.text.length}function nl(n,i){var e=r(n.doc,i),u=yi(n.doc,e),f,o;return u!=e&&(i=d(u)),f=rt(u),o=f?f[0].level%2?ue(u):re(u):0,t(i,o)}function vv(n,i){for(var e,u,f,o;e=br(u=r(n.doc,i));)i=e.find().to.line;return f=rt(u),o=f?f[0].level%2?re(u):ue(u):u.text.length,t(i,o)}function ts(n,t,i,r){var e=rt(n),s,h,o,u,c,f;if(!e)return tl(n,t,i,r);for(s=r?function(t,i){do t+=i;while(t>0&&gf.test(n.text.charAt(t)));return t}:function(n,t){return n+t},h=e[0].level,o=0;o<e.length;++o)if(u=e[o],c=u.level%2==h,u.from<t&&u.to>t||c&&(u.from==t||u.to==t))break;for(f=s(t,u.level%2?-i:i);f!=null;)if(u.level%2==h)if(f<u.from||f>u.to)u=e[o+=i],f=u&&(i>0==u.level%2?s(u.to,-1):s(u.from,1));else break;else if(f==go(u))u=e[--o],f=u&&ns(u);else if(f==ns(u))u=e[++o],f=u&&go(u);else break;return f<0||f>n.text.length?null:f}function tl(n,t,i,r){var u=t+i;if(r)while(u>0&&gf.test(n.text.charAt(u)))u+=i;return u<0||u>n.text.length?null:u}var ui=/gecko\/\d/i.test(navigator.userAgent),p=/MSIE \d/.test(navigator.userAgent),fi=p&&(document.documentMode==null||document.documentMode<8),yt=p&&(document.documentMode==null||document.documentMode<9),ft=/WebKit\//.test(navigator.userAgent),rl=ft&&/Qt\/\d+\.\d+/.test(navigator.userAgent),is=/Chrome\//.test(navigator.userAgent),et=/Opera\//.test(navigator.userAgent),fe=/Apple Computer/.test(navigator.vendor),ee=/KHTML\//.test(navigator.userAgent),ul=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),fl=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),el=/PhantomJS/.test(navigator.userAgent),uu=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),oe=uu||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),ei=uu||/Mac/.test(navigator.platform),ol=/windows/i.test(navigator.platform),nr=et&&navigator.userAgent.match(/Version\/(\d*\.\d*)/),pt,ps,pu,wu,hr,b,ds,ku,ge,gt,rf,fo,eo,uf,ai,ff,ef,tt,hf,co,lf,uc,k,fc,gr,vt,tu,di,po,iu,wc,gf,dc,ru,te,bo,ii,il;nr&&(nr=Number(nr[1]));var rs=ei&&(rl||et&&(nr==null||nr<12.11)),se=ui||p&&!yt,us=!1,tr=!1;ps=0,hr=0,b=null,p?b=-.53:ui?b=15:is?b=-.7:fe&&(b=-1/3),ku=null,n.Pos=t,n.prototype={focus:function(){window.focus(),w(this),bt(this),fr(this)},setOption:function(n,t){var i=this.options,r=i[n];(i[n]!=t||n=="mode")&&(i[n]=t,gt.hasOwnProperty(n)&&f(this,gt[n])(this,t,r))},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n){this.state.keyMaps.push(n)},removeKeyMap:function(n){for(var i=this.state.keyMaps,t=0;t<i.length;++t)if((typeof n=="string"?i[t].name:i[t])==n)return i.splice(t,1),!0},addOverlay:f(null,function(t,i){var r=t.token?t:n.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:r,modeSpec:t,opaque:i&&i.opaque}),this.state.modeGen++,c(this)}),removeOverlay:f(null,function(n){for(var i=this.state.overlays,t=0;t<i.length;++t)if(i[t].modeSpec==n){i.splice(t,1),this.state.modeGen++,c(this);return}}),indentLine:f(null,function(n,t,i){typeof t!="string"&&(t=t==null?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),dt(this.doc,n)&&nf(this,n,t,i)}),indentSelection:f(null,function(n){var t=this.doc.sel,r,i;if(s(t.from,t.to))return nf(this,t.from.line,n);for(r=t.to.line-(t.to.ch?0:1),i=t.from.line;i<=r;++i)nf(this,i,n)}),getTokenAt:function(n){var f=this.doc,i;n=u(f,n);for(var e=rr(this,n.line),o=this.doc.mode,s=r(f,n.line),t=new vr(s.text,this.options.tabSize);t.pos<n.ch&&!t.eol();)t.start=t.pos,i=o.token(t,e);return{start:t.start,end:t.pos,string:t.current(),className:i||null,type:i||null,state:e}},getStateAfter:function(n){var t=this.doc;return n=fh(t,n==null?t.first+t.size-1:n),rr(this,n+1)},cursorCoords:function(n,t){var r,i=this.doc.sel;return r=n==null?i.head:typeof n=="object"?u(this.doc,n):n?i.from:i.to,ot(this,r,t||"page")},charCoords:function(n,t){return we(this,u(this.doc,n),t||"page")},coordsChar:function(n){var t=l(this.display.lineSpace),i=window.pageYOffset||(document.documentElement||document.body).scrollTop,r=window.pageXOffset||(document.documentElement||document.body).scrollLeft;return be(this,n.left-t.left-r,n.top-t.top-i)},defaultTextHeight:function(){return vu(this.display)},setGutterMarker:f(null,function(n,t,i){return tf(this,n,function(n){var r=n.gutterMarkers||(n.gutterMarkers={});return r[t]=i,!i&&bc(r)&&(n.gutterMarkers=null),!0})}),clearGutter:f(null,function(n){var i=this,r=i.doc,t=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[n]&&(r.gutterMarkers[n]=null,c(i,t,t+1),bc(r.gutterMarkers)&&(r.gutterMarkers=null)),++t})}),addLineClass:f(null,function(n,t,i){return tf(this,n,function(n){var r=t=="text"?"textClass":t=="background"?"bgClass":"wrapClass";if(n[r]){if(new RegExp("\\b"+i+"\\b").test(n[r]))return!1;n[r]+=" "+i}else n[r]=i;return!0})}),removeLineClass:f(null,function(n,t,i){return tf(this,n,function(n){var r=t=="text"?"textClass":t=="background"?"bgClass":"wrapClass",u=n[r],f;if(u)if(i==null)n[r]=null;else{if(f=u.replace(new RegExp("^"+i+"\\b\\s*|\\s*\\b"+i+"\\b"),""),f==u)return!1;n[r]=f||null}else return!1;return!0})}),addLineWidget:f(null,function(n,t,i){return nv(this,n,t,i)}),removeLineWidget:function(n){n.clear()},lineInfo:function(n){var t;if(typeof n=="number"){if(!dt(this.doc,n)||(t=n,n=r(this.doc,n),!n))return null}else if(t=d(n),t==null)return null;return{line:t,handle:n,text:n.text,gutterMarkers:n.gutterMarkers,textClass:n.textClass,bgClass:n.bgClass,wrapClass:n.wrapClass,widgets:n.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(n,t,i,r,f){var o=this.display,s,e,h,c;n=ot(this,u(this.doc,n)),s=n.bottom,e=n.left,t.style.position="absolute",o.sizer.appendChild(t),r=="over"?s=n.top:(r=="above"||r=="near")&&(h=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth),(r=="above"||n.bottom+t.offsetHeight>h)&&n.top>t.offsetHeight?s=n.top-t.offsetHeight:n.bottom+t.offsetHeight<=h&&(s=n.bottom),e+t.offsetWidth>c&&(e=c-t.offsetWidth)),t.style.top=s+cu(o)+"px",t.style.left=t.style.right="",f=="right"?(e=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):(f=="left"?e=0:f=="middle"&&(e=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=e+"px"),i&&sh(this,e,s,e+t.offsetWidth,s+t.offsetHeight)},triggerOnKeyDown:f(null,nh),execCommand:function(n){return ef[n](this)},findPosH:function(n,t,i,r){var o=1,e,f;for(t<0&&(o=-1,t=-t),e=0,f=u(this.doc,n);e<t;++e)if(f=uo(this.doc,f,o,i,r),f.hitSide)break;return f},moveH:f(null,function(n,t){var i=this.doc.sel,r;r=i.shift||i.extend||s(i.from,i.to)?uo(this.doc,i.head,n,t,this.options.rtlMoveVisually):n<0?i.from:i.to,v(this.doc,r,r,n)}),deleteH:f(null,function(n,t){var i=this.doc.sel;s(i.from,i.to)?lt(this.doc,"",i.from,uo(this.doc,i.head,n,t,!1),"+delete"):lt(this.doc,"",i.from,i.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(n,t,i,r){var h=1,o=r,s,f,e;for(t<0&&(h=-1,t=-t),s=0,f=u(this.doc,n);s<t;++s)if(e=ot(this,f,"div"),o==null?o=e.left:e.left=o,f=hh(this,e,h,i),f.hitSide)break;return f},moveV:f(null,function(n,t){var i=this.doc.sel,r=ot(this,i.head,"div"),u;i.goalColumn!=null&&(r.left=i.goalColumn),u=hh(this,r,n,t),t=="page"&&(this.display.scrollbarV.scrollTop+=we(this,u,"div").top-r.top),v(this.doc,u,u,n),i.goalColumn=r.left}),toggleOverwrite:function(){(this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite","")},scrollTo:f(null,function(n,t){this.curOp.updateScrollPos={scrollLeft:n,scrollTop:t}}),getScrollInfo:function(){var n=this.display.scroller,t=di;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-t,width:n.scrollWidth-t,clientHeight:n.clientHeight-t,clientWidth:n.clientWidth-t}},scrollIntoView:function(n){typeof n=="number"&&(n=t(n,0)),n&&n.line==null?sh(this,n.left,n.top,n.right,n.bottom):(n=n?u(this.doc,n):this.doc.sel.head,oh(this,n))},setSize:function(n,t){function i(n){return typeof n=="number"||/^\d+$/.test(String(n))?n+"px":n}n!=null&&(this.display.wrapper.style.width=i(n)),t!=null&&(this.display.wrapper.style.height=i(t)),this.refresh()},on:function(n,t){e(this,n,t)},off:function(n,t){st(this,n,t)},operation:function(n){return ws(this,n)},refresh:f(null,function(){oi(this),this.curOp.updateScrollPos={scrollTop:this.doc.scrollTop,scrollLeft:this.doc.scrollLeft},c(this)}),swapDoc:f(null,function(n){var t=this.doc;return t.cm=null,ec(this,n),oi(this),this.curOp.updateScrollPos={scrollTop:n.scrollTop,scrollLeft:n.scrollLeft},t}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},gt=n.optionHandlers={},rf=n.defaults={},fo=n.Init={toString:function(){return"CodeMirror.Init"}},o("value","",function(n,t){n.setValue(t)},!0),o("mode",null,function(n,t){n.doc.modeOption=t,fu(n)},!0),o("indentUnit",2,fu,!0),o("indentWithTabs",!1),o("smartIndent",!0),o("tabSize",4,function(n){fu(n),oi(n),c(n)},!0),o("electricChars",!0),o("rtlMoveVisually",!ol),o("theme","default",function(n){os(n),ir(n)},!0),o("keyMap","default",cl),o("extraKeys",null),o("onKeyEvent",null),o("onDragEvent",null),o("lineWrapping",!1,hl,!0),o("gutters",[],function(n){ce(n.options),ir(n)},!0),o("fixedGutter",!0,function(n,t){n.display.gutters.style.left=t?ve(n.display)+"px":"0",n.refresh()},!0),o("lineNumbers",!1,function(n){ce(n.options),ir(n)},!0),o("firstLineNumber",1,ir,!0),o("lineNumberFormatter",function(n){return n},ir,!0),o("showCursorWhenSelecting",!1,pe,!0),o("readOnly",!1,function(n,t){t=="nocursor"?(de(n),n.display.input.blur()):t||wt(n,!0)}),o("dragDrop",!0),o("cursorBlinkRate",530),o("cursorHeight",1),o("workTime",100),o("workDelay",100),o("flattenSpans",!0),o("pollInterval",100),o("undoDepth",40,function(n,t){n.doc.history.undoDepth=t}),o("viewportMargin",10,function(n){n.refresh()},!0),o("tabindex",null,function(n,t){n.display.input.tabIndex=t||""}),o("autofocus",null),eo=n.modes={},uf=n.mimeModes={},n.defineMode=function(t,i){if(n.defaults.mode||t=="null"||(n.defaults.mode=t),arguments.length>2){i.dependencies=[];for(var r=2;r<arguments.length;++r)i.dependencies.push(arguments[r])}eo[t]=i},n.defineMIME=function(n,t){uf[n]=t},n.resolveMode=function(t){if(typeof t=="string"&&uf.hasOwnProperty(t))t=uf[t];else if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return n.resolveMode("application/xml");return typeof t=="string"?{name:t}:t||{name:"null"}},n.getMode=function(t,i){var e,r,f,u;if(i=n.resolveMode(i),e=eo[i.name],!e)return n.getMode(t,"text/plain");if(r=e(t,i),ai.hasOwnProperty(i.name)){f=ai[i.name];for(u in f)f.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=f[u])}return r.name=i.name,r},n.defineMode("null",function(){return{token:function(n){n.skipToEnd()}}}),n.defineMIME("text/plain","null"),ai=n.modeExtensions={},n.extendMode=function(n,t){var i=ai.hasOwnProperty(n)?ai[n]:ai[n]={};kf(t,i)},n.defineExtension=function(t,i){n.prototype[t]=i},n.defineOption=o,ff=[],n.defineInitHook=function(n){ff.push(n)},n.copyState=vi,n.startState=lh,n.innerMode=function(n,t){while(n.innerMode){var i=n.innerMode(t);t=i.state,n=i.mode}return i||{mode:n,state:t}},ef=n.commands={selectAll:function(n){n.setSelection(t(n.firstLine(),0),t(n.lastLine()))},killLine:function(n){var i=n.getCursor(!0),r=n.getCursor(!1),u=!s(i,r);u||n.getLine(i.line).length!=i.ch?n.replaceRange("",i,u?r:t(i.line),"+delete"):n.replaceRange("",i,t(i.line+1,0),"+delete")},deleteLine:function(n){var i=n.getCursor().line;n.replaceRange("",t(i,0),t(i),"+delete")},undo:function(n){n.undo()},redo:function(n){n.redo()},goDocStart:function(n){n.extendSelection(t(n.firstLine(),0))},goDocEnd:function(n){n.extendSelection(t(n.lastLine()))},goLineStart:function(n){n.extendSelection(nl(n,n.getCursor().line))},goLineStartSmart:function(n){var i=n.getCursor(),r=nl(n,i.line),f=n.getLineHandle(r.line),e=rt(f),u,o;e&&e[0].level!=0?n.extendSelection(r):(u=Math.max(0,f.text.search(/\S/)),o=i.line==r.line&&i.ch<=u&&i.ch,n.extendSelection(t(r.line,o?0:u)))},goLineEnd:function(n){n.extendSelection(vv(n,n.getCursor().line))},goLineUp:function(n){n.moveV(-1,"line")},goLineDown:function(n){n.moveV(1,"line")},goPageUp:function(n){n.moveV(-1,"page")},goPageDown:function(n){n.moveV(1,"page")},goCharLeft:function(n){n.moveH(-1,"char")},goCharRight:function(n){n.moveH(1,"char")},goColumnLeft:function(n){n.moveH(-1,"column")},goColumnRight:function(n){n.moveH(1,"column")},goWordLeft:function(n){n.moveH(-1,"word")},goWordRight:function(n){n.moveH(1,"word")},delCharBefore:function(n){n.deleteH(-1,"char")},delCharAfter:function(n){n.deleteH(1,"char")},delWordBefore:function(n){n.deleteH(-1,"word")},delWordAfter:function(n){n.deleteH(1,"word")},indentAuto:function(n){n.indentSelection("smart")},indentMore:function(n){n.indentSelection("add")},indentLess:function(n){n.indentSelection("subtract")},insertTab:function(n){n.replaceSelection("\t","end","+input")},defaultTab:function(n){n.somethingSelected()?n.indentSelection("add"):n.replaceSelection("\t","end","+input")},transposeChars:function(n){var i=n.getCursor(),r=n.getLine(i.line);i.ch>0&&i.ch<r.length-1&&n.replaceRange(r.charAt(i.ch)+r.charAt(i.ch-1),t(i.line,i.ch-1),t(i.line,i.ch+1))},newlineAndIndent:function(n){f(n,function(){n.replaceSelection("\n","end","+input"),n.indentLine(n.getCursor().line,null,!0)})()},toggleOverwrite:function(n){n.toggleOverwrite()}},tt=n.keyMap={},tt.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},tt.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordBefore","Ctrl-Delete":"delWordAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"},tt.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordBefore","Ctrl-Alt-Backspace":"delWordAfter","Alt-Delete":"delWordAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore",fallthrough:["basic","emacsy"]},tt["default"]=ei?tt.macDefault:tt.pcDefault,tt.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},n.lookupKey=ar,n.isModifierKey=ah,n.keyName=vh,n.fromTextArea=function(t,i){function f(){t.value=r.getValue()}var o,u,s,h,r;if(i||(i={}),i.value=t.value,!i.tabindex&&t.tabindex&&(i.tabindex=t.tabindex),i.autofocus==null){o=document.body;try{o=document.activeElement}catch(c){}i.autofocus=o==t||t.getAttribute("autofocus")!=null&&o==document.body}if(t.form){e(t.form,"submit",f),u=t.form,s=u.submit;try{h=u.submit=function(){f(),u.submit=s,u.submit(),u.submit=h}}catch(c){}}return t.style.display="none",r=n(function(n){t.parentNode.insertBefore(n,t.nextSibling)},i),r.save=f,r.getTextArea=function(){return t},r.toTextArea=function(){f(),t.parentNode.removeChild(r.getWrapperElement()),t.style.display="",t.form&&(st(t.form,"submit",f),typeof t.form.submit=="function"&&(t.form.submit=s))},r},vr.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(n){var t=this.string.charAt(this.pos),i;return i=typeof n=="string"?t==n:t&&(n.test?n.test(t):n(t)),i?(++this.pos,t):void 0},eatWhile:function(n){for(var t=this.pos;this.eat(n););return this.pos>t},eatSpace:function(){for(var n=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>n},skipToEnd:function(){this.pos=this.string.length},skipTo:function(n){var t=this.string.indexOf(n,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(n){this.pos-=n},column:function(){return gi(this.string,this.start,this.tabSize)},indentation:function(){return gi(this.string,null,this.tabSize)},match:function(n,t,i){var u,r;if(typeof n=="string"){if(u=function(n){return i?n.toLowerCase():n},u(this.string).indexOf(u(n),this.pos)==this.pos)return t!==!1&&(this.pos+=n.length),!0}else return(r=this.string.slice(this.pos).match(n),r&&r.index>0)?null:(r&&t!==!1&&(this.pos+=r[0].length),r)},current:function(){return this.string.slice(this.start,this.pos)}},n.StringStream=vr,n.TextMarker=ni,ni.prototype.clear=function(){var n,f,r,e,i,u,t,o,s;if(!this.explicitlyCleared){for(n=this.doc.cm,f=n&&!n.curOp,f&&si(n),r=null,e=null,t=0;t<this.lines.length;++t)i=this.lines[t],u=wr(i.markedSpans,this),u.to!=null&&(e=d(i)),i.markedSpans=wa(i.markedSpans,u),u.from!=null?r=d(i):this.collapsed&&!ti(this.doc,i)&&n&&it(i,vu(n.display));if(n&&this.collapsed&&!n.options.lineWrapping)for(t=0;t<this.lines.length;++t)o=yi(n.doc,this.lines[t]),s=eu(n.doc,o),s>n.display.maxLineLength&&(n.display.maxLine=o,n.display.maxLineLength=s,n.display.maxLineChanged=!0);r!=null&&n&&c(n,r,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.collapsed&&this.doc.cantEdit&&(this.doc.cantEdit=!1,n&&eh(n)),f&&hi(n),ut(this,"clear")}},ni.prototype.find=function(){for(var i,e,u,n,f,r=0;r<this.lines.length;++r)u=this.lines[r],n=wr(u.markedSpans,this),(n.from!=null||n.to!=null)&&(f=d(u),n.from!=null&&(i=t(f,n.from)),n.to!=null&&(e=t(f,n.to)));return this.type=="bookmark"?i:i&&{from:i,to:e}},ni.prototype.getOptions=function(n){var t=this.replacedWith;return{className:this.className,inclusiveLeft:this.inclusiveLeft,inclusiveRight:this.inclusiveRight,atomic:this.atomic,collapsed:this.collapsed,clearOnEnter:this.clearOnEnter,replacedWith:n?t&&t.cloneNode(!0):t,readOnly:this.readOnly,startStyle:this.startStyle,endStyle:this.endStyle}},ni.prototype.attachLine=function(n){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&ht(t.maybeHiddenMarkers,this)!=-1||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(n)},ni.prototype.detachLine=function(n){if(this.lines.splice(ht(this.lines,n),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},n.SharedTextMarker=pr,pr.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var n=0;n<this.markers.length;++n)this.markers[n].clear();ut(this,"clear")}},pr.prototype.find=function(){return this.primary.find()},pr.prototype.getOptions=function(n){var t=this.primary.getOptions(n);return t.shared=!0,t},hf=n.LineWidget=function(n,t,i){for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.cm=n,this.node=t},hf.prototype.clear=bh(function(){var n=this.line.widgets,i=d(this.line),t;if(i!=null&&n){for(t=0;t<n.length;++t)n[t]==this&&n.splice(t--,1);n.length||(this.line.widgets=null),it(this.line,Math.max(0,this.line.height-cf(this))),c(this.cm,i,i+1)}}),hf.prototype.changed=bh(function(){var i=this.height,n,t;(this.height=null,n=cf(this)-i,n)&&(it(this.line,this.line.height+n),t=d(this.line),c(this.cm,t,t+1))}),co={},lf=/[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g,af.prototype={chunkSize:function(){return this.lines.length},removeInner:function(n,t){for(var r,i=n,u=n+t;i<u;++i)r=this.lines[i],this.height-=r.height,tv(r),ut(r,"delete");this.lines.splice(n,t)},collapse:function(n){n.splice.apply(n,[n.length,0].concat(this.lines))},insertInner:function(n,t,i){this.height+=i,this.lines=this.lines.slice(0,n).concat(t).concat(this.lines.slice(n));for(var r=0,u=t.length;r<u;++r)t[r].parent=this},iterN:function(n,t,i){for(var r=n+t;n<r;++n)if(i(this.lines[n]))return!0}},dr.prototype={chunkSize:function(){return this.size},removeInner:function(n,t){var r,i,u,f,o,e;for(this.size-=t,r=0;r<this.children.length;++r)if(i=this.children[r],u=i.chunkSize(),n<u){if(f=Math.min(t,u-n),o=i.height,i.removeInner(n,f),this.height-=o-i.height,u==f&&(this.children.splice(r--,1),i.parent=null),(t-=f)==0)break;n=0}else n-=u;this.size-t<25&&(e=[],this.collapse(e),this.children=[new af(e)],this.children[0].parent=this)},collapse:function(n){for(var t=0,i=this.children.length;t<i;++t)this.children[t].collapse(n)},insertInner:function(n,t,i){var u,o,r,e,s,f;for(this.size+=t.length,this.height+=i,u=0,o=this.children.length;u<o;++u){if(r=this.children[u],e=r.chunkSize(),n<=e){if(r.insertInner(n,t,i),r.lines&&r.lines.length>50){while(r.lines.length>50)s=r.lines.splice(r.lines.length-25,25),f=new af(s),r.height-=f.height,this.children.splice(u+1,0,f),f.parent=this;this.maybeSpill()}break}n-=e}},maybeSpill:function(){var n,r,t,i,u;if(!(this.children.length<=10)){n=this;do r=n.children.splice(n.children.length-5,5),t=new dr(r),n.parent?(n.size-=t.size,n.height-=t.height,u=ht(n.parent.children,n),n.parent.children.splice(u+1,0,t)):(i=new dr(n.children),i.parent=n,n.children=[i,t],n=i),t.parent=n.parent;while(n.children.length>10);n.parent.maybeSpill()}},iterN:function(n,t,i){for(var f,u,e,r=0,o=this.children.length;r<o;++r)if(f=this.children[r],u=f.chunkSize(),n<u){if(e=Math.min(t,u-n),f.iterN(n,e,i))return!0;if((t-=e)==0)break;n=0}else n-=u}},uc=0,k=n.Doc=function(n,i,r){if(!(this instanceof k))return new k(n,i,r);r==null&&(r=0),dr.call(this,[new af([kr("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=yf(),this.frontier=r;var u=t(r,0);this.sel={from:u,to:u,head:u,anchor:u,shift:!1,extend:!1,goalColumn:null},this.id=++uc,this.modeOption=i,typeof n=="string"&&(n=ii(n)),lo(this,{from:u,to:u,text:n},null,{head:u,anchor:u})},k.prototype=cv(dr.prototype,{iter:function(n,t,i){i?this.iterN(n-this.first,t-n,i):this.iterN(this.first,this.first+this.size,n)},insert:function(n,t){for(var r=0,i=0,u=t.length;i<u;++i)r+=t[i].height;this.insertInner(n-this.first,t,r)},remove:function(n,t){this.removeInner(n-this.first,t)},getValue:function(n){var t=ao(this,this.first,this.first+this.size);return n===!1?t:t.join(n||"\n")},setValue:function(n){var i=t(this.first,0),u=this.first+this.size-1;cr(this,{from:i,to:t(u,r(this,u).text.length),text:ii(n),origin:"setValue"},{head:i,anchor:i},!0)},replaceRange:function(n,t,i,r){t=u(this,t),i=i?u(this,i):t,lt(this,n,t,i,r)},getRange:function(n,t,i){var r=oc(this,u(this,n),u(this,t));return i===!1?r:r.join(i||"\n")},getLine:function(n){var t=this.getLineHandle(n);return t&&t.text},setLine:function(n,i){dt(this,n)&&lt(this,i,t(n,0),u(this,t(n)))},removeLine:function(n){dt(this,n)&&lt(this,"",t(n,0),u(this,t(n+1,0)))},getLineHandle:function(n){if(dt(this,n))return r(this,n)},getLineNumber:function(n){return d(n)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(n){return u(this,n)},getCursor:function(n){var t=this.sel,i;return i=n==null||n=="head"?t.head:n=="anchor"?t.anchor:n=="end"||n===!1?t.to:t.from,kt(i)},somethingSelected:function(){return!s(this.sel.head,this.sel.anchor)},setCursor:ur(function(n,i,r){var f=u(this,typeof n=="number"?t(n,i||0):n);r?v(this,f):at(this,f,f)}),setSelection:ur(function(n,t){at(this,u(this,n),u(this,t||n))}),extendSelection:ur(function(n,t){v(this,u(this,n),t&&u(this,t))}),getSelection:function(n){return this.getRange(this.sel.from,this.sel.to,n)},replaceSelection:function(n,t,i){cr(this,{from:this.sel.from,to:this.sel.to,text:ii(n),origin:i},t||"around")},undo:ur(function(){rh(this,"undo")}),redo:ur(function(){rh(this,"redo")}),setExtending:function(n){this.sel.extend=n},historySize:function(){var n=this.history;return{undo:n.done.length,redo:n.undone.length}},clearHistory:function(){this.history=yf()},markClean:function(){this.history.dirtyCounter=0,this.history.lastOp=this.history.lastOrigin=null},isClean:function(){return this.history.dirtyCounter==0},getHistory:function(){return{done:pf(this.history.done),undone:pf(this.history.undone)}},setHistory:function(n){var t=this.history=yf();t.done=n.done.slice(0),t.undone=n.undone.slice(0)},markText:function(n,t,i){return yr(this,u(this,n),u(this,t),i,"range")},setBookmark:function(n,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft};return n=u(this,n),yr(this,n,n,i,"bookmark")},findMarksAt:function(n){var e,i,f,t;if(n=u(this,n),e=[],i=r(this,n.line).markedSpans,i)for(f=0;f<i.length;++f)t=i[f],(t.from==null||t.from<=n.ch)&&(t.to==null||t.to>=n.ch)&&e.push(t.marker.parent||t.marker);return e},getAllMarks:function(){var n=[];return this.iter(function(t){var r=t.markedSpans,i;if(r)for(i=0;i<r.length;++i)r[i].from!=null&&n.push(r[i].marker)}),n},posFromIndex:function(n){var i,r=this.first;return this.iter(function(t){var u=t.text.length+1;if(u>n)return i=n,!0;n-=u,++r}),u(this,t(r,i))},indexFromPos:function(n){n=u(this,n);var t=n.ch;return n.line<this.first||n.ch<0?0:(this.iter(this.first,n.line,function(n){t+=n.text.length+1}),t)},copy:function(n){var t=new k(ao(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn},n&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(n){var t,r,i;return n||(n={}),t=this.first,r=this.first+this.size,n.from!=null&&n.from>t&&(t=n.from),n.to!=null&&n.to<r&&(r=n.to),i=new k(ao(this,t,r),n.mode||this.modeOption,t),n.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:n.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:n.sharedHist}],i},unlinkDoc:function(t){var i,u,r;if(t instanceof n&&(t=t.doc),this.linked)for(i=0;i<this.linked.length;++i)if(u=this.linked[i],u.doc==t){this.linked.splice(i,1),t.unlinkDoc(this);break}t.history==this.history&&(r=[t.id],wi(t,function(n){r.push(n.id)},!0),t.history=yf(),t.history.done=pf(this.history.done,r),t.history.undone=pf(this.history.undone,r))},iterLinkedDocs:function(n){wi(this,n)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),k.prototype.eachLine=k.prototype.iter,fc="iter insert remove copy getEditor".split(" ");for(gr in k.prototype)k.prototype.hasOwnProperty(gr)&&ht(fc,gr)<0&&(n.prototype[gr]=function(n){return function(){return n.apply(this.doc,arguments)}}(k.prototype[gr]));n.e_stop=bf,n.e_preventDefault=a,n.e_stopPropagation=lc,tu=0,n.on=e,n.off=st,n.signal=g,di=30,po=n.Pass={toString:function(){return"CodeMirror.Pass"}},wo.prototype={set:function(n,t){clearTimeout(this.id),this.id=setTimeout(t,n)}},n.countColumn=gi,iu=[""],wc=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc]/,gf=/[\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\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/,n.replaceGetRect=function(n){l=n},dc=function(){if(yt)return!1;var n=i("div");return"draggable"in n||"dragDrop"in n}(),ru=/^$/,ui?ru=/$'/:fe?ru=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:is&&(ru=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/),ii="\n\nb".split(/\n/).length!=3?function(n){for(var i=0,f=[],e=n.length,t,r,u;i<=e;)t=n.indexOf("\n",i),t==-1&&(t=n.length),r=n.slice(i,n.charAt(t-1)=="\r"?t-1:t),u=r.indexOf("\r"),u!=-1?(f.push(r.slice(0,u)),i+=u+1):(f.push(r),i=t+1);return f}:function(n){return n.split(/\r\n?|\n/)},n.splitLines=ii;var lv=window.getSelection?function(n){try{return n.selectionStart!=n.selectionEnd}catch(t){return!1}}:function(n){try{var t=n.ownerDocument.selection.createRange()}catch(i){}return!t||t.parentElement()!=n?!1:t.compareEndPoints("StartToEnd",t)!=0},gc=function(){var n=i("div");return"oncopy"in n?!0:(n.setAttribute("oncopy","return;"),typeof n.oncopy=="function")}(),ri={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};return n.keyNames=ri,function(){for(var n=0;n<10;n++)ri[n+48]=String(n);for(n=65;n<=90;n++)ri[n]=String.fromCharCode(n);for(n=1;n<=12;n++)ri[n+111]=ri[n+63235]="F"+n}(),il=function(){function o(n){return n<=255?f.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1791?e.charAt(n-1536):1792<=n&&n<=2220?"r":"L"}var f="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",e="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",s=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,i=/[LRr]/,r=/[Lb1n]/,u=/[1n]/,n="L";return function(f){var a,h,w,g,b,c,v,p,d,e,tt,k,nt,l,it;if(!s.test(f))return!1;for(a=f.length,h=[],e=0;e<a;++e)h.push(c=o(f.charCodeAt(e)));for(e=0,w=n;e<a;++e)c=h[e],c=="m"?h[e]=w:w=c;for(e=0,b=n;e<a;++e)c=h[e],c=="1"&&b=="r"?h[e]="n":i.test(c)&&(b=c,c=="r"&&(h[e]="R"));for(e=1,w=h[0];e<a-1;++e)c=h[e],c=="+"&&w=="1"&&h[e+1]=="1"?h[e]="1":c==","&&w==h[e+1]&&(w=="1"||w=="n")&&(h[e]=w),w=c;for(e=0;e<a;++e)if(c=h[e],c==",")h[e]="N";else if(c=="%"){for(v=e+1;v<a&&h[v]=="%";++v);for(g=e&&h[e-1]=="!"||v<a-1&&h[v]=="1"?"1":"N",l=e;l<v;++l)h[l]=g;e=v-1}for(e=0,b=n;e<a;++e)c=h[e],b=="L"&&c=="1"?h[e]="L":i.test(c)&&(b=c);for(e=0;e<a;++e)if(t.test(h[e])){for(v=e+1;v<a&&t.test(h[v]);++v);var rt=(e?h[e-1]:n)=="L",ut=(v<a-1?h[v]:n)=="L",g=rt||ut?"L":"R";for(l=e;l<v;++l)h[l]=g;e=v-1}for(p=[],e=0;e<a;)if(r.test(h[e])){for(tt=e,++e;e<a&&r.test(h[e]);++e);p.push({from:tt,to:e,level:0})}else{for(k=e,nt=p.length,++e;e<a&&h[e]!="L";++e);for(l=k;l<e;)if(u.test(h[l])){for(k<l&&p.splice(nt,0,{from:k,to:l,level:1}),it=l,++l;l<e&&u.test(h[l]);++l);p.splice(nt,0,{from:it,to:l,level:2}),k=l}else++l;k<e&&p.splice(nt,0,{from:k,to:e,level:1})}return p[0].level==1&&(d=f.match(/^\s+/))&&(p[0].from=d[0].length,p.unshift({from:0,to:d[0].length,level:0})),y(p).level==1&&(d=f.match(/\s+$/))&&(y(p).to-=d[0].length,p.push({from:a-d[0].length,to:a,level:0})),p[0].level!=y(p).level&&p.push({from:a,to:a,level:p[0].level}),p}}(),n.version="3.1",n}()
@@ -1 +0,0 @@
1
- CodeMirror.defineMode("xml",function(config,parserConfig){function inText(stream,state){function chain(parser){return state.tokenize=parser,parser(stream,state)}var ch=stream.next(),isClose,c,ok;if(ch=="<"){if(stream.eat("!"))return stream.eat("[")?stream.match("CDATA[")?chain(inBlock("atom","]\]>")):null:stream.match("--")?chain(inBlock("comment","-->")):stream.match("DOCTYPE",!0,!0)?(stream.eatWhile(/[\w\._\-]/),chain(doctype(1))):null;if(stream.eat("?"))return stream.eatWhile(/[\w\._\-]/),state.tokenize=inBlock("meta","?>"),"meta";for(isClose=stream.eat("/"),tagName="";c=stream.eat(/[^\s\u00a0=<>\"\'\/?]/);)tagName+=c;return tagName?(type=isClose?"closeTag":"openTag",state.tokenize=inTag,"tag"):"error"}return ch=="&"?(ok=stream.eat("#")?stream.eat("x")?stream.eatWhile(/[a-fA-F\d]/)&&stream.eat(";"):stream.eatWhile(/[\d]/)&&stream.eat(";"):stream.eatWhile(/[\w\.\-:]/)&&stream.eat(";"),ok?"atom":"error"):(stream.eatWhile(/[^&<]/),null)}function inTag(stream,state){var ch=stream.next();return ch==">"||ch=="/"&&stream.eat(">")?(state.tokenize=inText,type=ch==">"?"endTag":"selfcloseTag","tag"):ch=="="?(type="equals",null):/[\'\"]/.test(ch)?(state.tokenize=inAttribute(ch),state.tokenize(stream,state)):(stream.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function inAttribute(quote){return function(stream,state){while(!stream.eol())if(stream.next()==quote){state.tokenize=inTag;break}return"string"}}function inBlock(style,terminator){return function(stream,state){while(!stream.eol()){if(stream.match(terminator)){state.tokenize=inText;break}stream.next()}return style}}function doctype(depth){return function(stream,state){for(var ch;(ch=stream.next())!=null;){if(ch=="<")return state.tokenize=doctype(depth+1),state.tokenize(stream,state);if(ch==">")if(depth==1){state.tokenize=inText;break}else return state.tokenize=doctype(depth-1),state.tokenize(stream,state)}return"meta"}}function pass(){for(var i=arguments.length-1;i>=0;i--)curState.cc.push(arguments[i])}function cont(){return pass.apply(null,arguments),!0}function pushContext(tagName,startOfLine){var noIndent=Kludges.doNotIndent.hasOwnProperty(tagName)||curState.context&&curState.context.noIndent;curState.context={prev:curState.context,tagName:tagName,indent:curState.indented,startOfLine:startOfLine,noIndent:noIndent}}function popContext(){curState.context&&(curState.context=curState.context.prev)}function element(type){if(type=="openTag")return curState.tagName=tagName,cont(attributes,endtag(curState.startOfLine));if(type=="closeTag"){var err=!1;return curState.context?curState.context.tagName!=tagName&&(Kludges.implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())&&popContext(),err=!curState.context||curState.context.tagName!=tagName):err=!0,err&&(setStyle="error"),cont(endclosetag(err))}return cont()}function endtag(startOfLine){return function(type){var tagName=curState.tagName;return(curState.tagName=null,type=="selfcloseTag"||type=="endTag"&&Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase()))?(maybePopContext(tagName.toLowerCase()),cont()):type=="endTag"?(maybePopContext(tagName.toLowerCase()),pushContext(tagName,startOfLine),cont()):cont()}}function endclosetag(err){return function(type){return(err&&(setStyle="error"),type=="endTag")?(popContext(),cont()):(setStyle="error",cont(arguments.callee))}}function maybePopContext(nextTagName){for(var parentTagName;;){if(!curState.context)return;if(parentTagName=curState.context.tagName.toLowerCase(),!Kludges.contextGrabbers.hasOwnProperty(parentTagName)||!Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName))return;popContext()}}function attributes(type){return type=="word"?(setStyle="attribute",cont(attribute,attributes)):type=="endTag"||type=="selfcloseTag"?pass():(setStyle="error",cont(attributes))}function attribute(type){return type=="equals"?cont(attvalue,attributes):(Kludges.allowMissing?type=="word"&&(setStyle="attribute"):setStyle="error",type=="endTag"||type=="selfcloseTag"?pass():cont())}function attvalue(type){return type=="string"?cont(attvaluemaybe):type=="word"&&Kludges.allowUnquoted?(setStyle="string",cont()):(setStyle="error",type=="endTag"||type=="selfCloseTag"?pass():cont())}function attvaluemaybe(type){return type=="string"?cont(attvaluemaybe):pass()}var indentUnit=config.indentUnit,Kludges=parserConfig.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},alignCDATA=parserConfig.alignCDATA,tagName,type,curState,setStyle;return{startState:function(){return{tokenize:inText,cc:[],indented:0,startOfLine:!0,tagName:null,context:null}},token:function(stream,state){var style,comb;if(stream.sol()&&(state.startOfLine=!0,state.indented=stream.indentation()),stream.eatSpace())return null;if(setStyle=type=tagName=null,style=state.tokenize(stream,state),state.type=type,(style||type)&&style!="comment")for(curState=state;;)if(comb=state.cc.pop()||element,comb(type||style))break;return state.startOfLine=!1,setStyle||style},indent:function(state,textAfter,fullLine){var context=state.context;if(state.tokenize!=inTag&&state.tokenize!=inText||context&&context.noIndent)return fullLine?fullLine.match(/^(\s*)/)[0].length:0;if(alignCDATA&&/<!\[CDATA\[/.test(textAfter))return 0;for(context&&/^<\//.test(textAfter)&&(context=context.prev);context&&!context.startOfLine;)context=context.prev;return context?context.indent+indentUnit:0},electricChars:"/",configuration:parserConfig.htmlMode?"html":"xml"}}),CodeMirror.defineMIME("text/xml","xml"),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}),CodeMirror.defineMode("css",function(config){function keySet(array){for(var keys={},i=0;i<array.length;++i)keys[array[i]]=!0;return keys}function ret(style,tp){return type=tp,style}function tokenBase(stream,state){var ch=stream.next();if(ch=="@")return stream.eatWhile(/[\w\\\-]/),ret("def",stream.current());if(ch=="/"&&stream.eat("*"))return state.tokenize=tokenCComment,tokenCComment(stream,state);if(ch=="<"&&stream.eat("!"))return state.tokenize=tokenSGMLComment,tokenSGMLComment(stream,state);if(ch=="=")ret(null,"compare");else{if((ch=="~"||ch=="|")&&stream.eat("="))return ret(null,"compare");if(ch=='"'||ch=="'")return state.tokenize=tokenString(ch),state.tokenize(stream,state);if(ch=="#")return stream.eatWhile(/[\w\\\-]/),ret("atom","hash");if(ch=="!")return stream.match(/^\s*\w*/),ret("keyword","important");if(/\d/.test(ch))return stream.eatWhile(/[\w.%]/),ret("number","unit");if(ch==="-"){if(/\d/.test(stream.peek()))return stream.eatWhile(/[\w.%]/),ret("number","unit");if(stream.match(/^[^-]+-/))return ret("meta","meta")}else return/[,+>*\/]/.test(ch)?ret(null,"select-op"):ch=="."&&stream.match(/^-?[_a-z][_a-z0-9-]*/i)?ret("qualifier","qualifier"):ch==":"?ret("operator",ch):/[;{}\[\]\(\)]/.test(ch)?ret(null,ch):ch=="u"&&stream.match("rl(")?(stream.backUp(1),state.tokenize=tokenParenthesized,ret("property","variable")):(stream.eatWhile(/[\w\\\-]/),ret("property","variable"))}}function tokenCComment(stream,state){for(var maybeEnd=!1,ch;(ch=stream.next())!=null;){if(maybeEnd&&ch=="/"){state.tokenize=tokenBase;break}maybeEnd=ch=="*"}return ret("comment","comment")}function tokenSGMLComment(stream,state){for(var dashes=0,ch;(ch=stream.next())!=null;){if(dashes>=2&&ch==">"){state.tokenize=tokenBase;break}dashes=ch=="-"?dashes+1:0}return ret("comment","comment")}function tokenString(quote,nonInclusive){return function(stream,state){for(var escaped=!1,ch;(ch=stream.next())!=null;){if(ch==quote&&!escaped)break;escaped=!escaped&&ch=="\\"}return escaped||(nonInclusive&&stream.backUp(1),state.tokenize=tokenBase),ret("string","string")}}function tokenParenthesized(stream,state){return stream.next(),state.tokenize=stream.match(/\s*[\"\']/,!1)?tokenBase:tokenString(")",!0),ret(null,"(")}var indentUnit=config.indentUnit,type,atMediaTypes=keySet(["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]),atMediaFeatures=keySet(["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"]),propertyKeywords=keySet(["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid-cell","grid-column","grid-column-align","grid-column-sizing","grid-column-span","grid-columns","grid-flow","grid-row","grid-row-align","grid-row-sizing","grid-row-span","grid-rows","grid-template","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-shadow","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index"]),colorKeywords=keySet(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua"]),valueKeywords=keySet(["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","navy","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","overlay","overline","padding","padding-box","painted","paused","persian","plus-darker","plus-lighter","pointer","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","white","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small","yellow"]);return{startState:function(base){return{tokenize:tokenBase,baseIndent:base||0,stack:[]}},token:function(stream,state){if(state.tokenize==tokenBase&&stream.eatSpace())return null;var style=state.tokenize(stream,state),context=state.stack[state.stack.length-1];return style=="property"?context=="propertyValue"?style=valueKeywords[stream.current()]?"string-2":colorKeywords[stream.current()]?"keyword":"variable-2":context=="rule"?propertyKeywords[stream.current()]||(style+=" error"):context&&context!="@media{"?context=="@media"?style=atMediaTypes[stream.current()]?"attribute":/^(only|not)$/i.test(stream.current())?"keyword":stream.current().toLowerCase()=="and"?"error":atMediaFeatures[stream.current()]?"error":"attribute error":context=="@mediaType"?style=atMediaTypes[stream.current()]?"attribute":stream.current().toLowerCase()=="and"?"operator":/^(only|not)$/i.test(stream.current())?"error":atMediaFeatures[stream.current()]?"error":"error":context=="@mediaType("?propertyKeywords[stream.current()]||(atMediaTypes[stream.current()]?style="error":stream.current().toLowerCase()=="and"?style="operator":/^(only|not)$/i.test(stream.current())?style="error":style+=" error"):style="error":style="tag":style=="atom"?context&&context!="@media{"?context=="propertyValue"?/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())||(style+=" error"):style="error":style="builtin":context=="@media"&&type=="{"&&(style="error"),type=="{"?context=="@media"||context=="@mediaType"?(state.stack.pop(),state.stack[state.stack.length-1]="@media{"):state.stack.push("rule"):type=="}"?(state.stack.pop(),context=="propertyValue"&&state.stack.pop()):type=="@media"?state.stack.push("@media"):context=="@media"&&/\b(keyword|attribute)\b/.test(style)?state.stack.push("@mediaType"):context=="@mediaType"&&stream.current()==","?state.stack.pop():context=="@mediaType"&&type=="("?state.stack.push("@mediaType("):context=="@mediaType("&&type==")"?state.stack.pop():context=="rule"&&type==":"?state.stack.push("propertyValue"):context=="propertyValue"&&type==";"&&state.stack.pop(),style},indent:function(state,textAfter){var n=state.stack.length;return/^\}/.test(textAfter)&&(n-=state.stack[state.stack.length-1]=="propertyValue"?2:1),state.baseIndent+n*indentUnit},electricChars:"}"}}),CodeMirror.defineMIME("text/css","css"),CodeMirror.defineMode("htmlmixed",function(config,parserConfig){function html(stream,state){var tagName=state.htmlState.tagName,style=htmlMode.token(stream,state.htmlState),scriptType,i,tp;if(tagName=="script"&&/\btag\b/.test(style)&&stream.current()==">"){for(scriptType=stream.string.slice(Math.max(0,stream.pos-100),stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i),scriptType=scriptType?scriptType[1]:"",scriptType&&/[\"\']/.test(scriptType.charAt(0))&&(scriptType=scriptType.slice(1,scriptType.length-1)),i=0;i<scriptTypes.length;++i)if(tp=scriptTypes[i],typeof tp.matches=="string"?scriptType==tp.matches:tp.matches.test(scriptType)){tp.mode&&(state.token=script,state.localMode=tp.mode,state.localState=tp.mode.startState&&tp.mode.startState(htmlMode.indent(state.htmlState,"")));break}}else tagName=="style"&&/\btag\b/.test(style)&&stream.current()==">"&&(state.token=css,state.localMode=cssMode,state.localState=cssMode.startState(htmlMode.indent(state.htmlState,"")));return style}function maybeBackup(stream,pat,style){var cur=stream.current(),close=cur.search(pat),m;return close>-1?stream.backUp(cur.length-close):(m=cur.match(/<\/?$/))&&(stream.backUp(cur.length),stream.match(pat,!1)||stream.match(cur[0])),style}function script(stream,state){return stream.match(/^<\/\s*script\s*>/i,!1)?(state.token=html,state.localState=state.localMode=null,html(stream,state)):maybeBackup(stream,/<\/\s*script\s*>/,state.localMode.token(stream,state.localState))}function css(stream,state){return stream.match(/^<\/\s*style\s*>/i,!1)?(state.token=html,state.localState=state.localMode=null,html(stream,state)):maybeBackup(stream,/<\/\s*style\s*>/,cssMode.token(stream,state.localState))}var htmlMode=CodeMirror.getMode(config,{name:"xml",htmlMode:!0}),cssMode=CodeMirror.getMode(config,"css"),scriptTypes=[],scriptTypesConf=parserConfig&&parserConfig.scriptTypes,i,conf;if(scriptTypes.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(config,"javascript")}),scriptTypesConf)for(i=0;i<scriptTypesConf.length;++i)conf=scriptTypesConf[i],scriptTypes.push({matches:conf.matches,mode:conf.mode&&CodeMirror.getMode(config,conf.mode)});return scriptTypes.push({matches:/./,mode:CodeMirror.getMode(config,"text/plain")}),{startState:function(){var state=htmlMode.startState();return{token:html,localMode:null,localState:null,htmlState:state}},copyState:function(state){if(state.localState)var local=CodeMirror.copyState(state.localMode,state.localState);return{token:state.token,localMode:state.localMode,localState:local,htmlState:CodeMirror.copyState(htmlMode,state.htmlState)}},token:function(stream,state){return state.token(stream,state)},indent:function(state,textAfter){return!state.localMode||/^\s*<\//.test(textAfter)?htmlMode.indent(state.htmlState,textAfter):state.localMode.indent?state.localMode.indent(state.localState,textAfter):CodeMirror.Pass},electricChars:"/{}:",innerMode:function(state){return{state:state.localState||state.htmlState,mode:state.localMode||htmlMode}}}},"xml","javascript","css"),CodeMirror.defineMIME("text/html","htmlmixed");
@@ -1 +0,0 @@
1
- (function(){function n(n,t,i){var u=n.getWrapperElement(),r;return r=u.appendChild(document.createElement("div")),r.className=i?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top",r.innerHTML=t,r}CodeMirror.defineExtension("openDialog",function(t,i,r){function f(){s||(s=!0,e.parentNode.removeChild(e))}var e=n(this,t,r&&r.bottom),s=!1,h=this,u=e.getElementsByTagName("input")[0],o;if(u){CodeMirror.on(u,"keydown",function(n){(n.keyCode==13||n.keyCode==27)&&(CodeMirror.e_stop(n),f(),h.focus(),n.keyCode==13&&i(u.value))});r&&r.value&&(u.value=r.value),u.focus();CodeMirror.on(u,"blur",f)}else if(o=e.getElementsByTagName("button")[0]){CodeMirror.on(o,"click",function(){f(),h.focus()});o.focus();CodeMirror.on(o,"blur",f)}return f}),CodeMirror.defineExtension("openConfirm",function(t,i,r){function l(){h||(h=!0,e.parentNode.removeChild(e),c.focus())}var e=n(this,t,r&&r.bottom),o=e.getElementsByTagName("button"),h=!1,c=this,s=1,u,f;for(o[0].focus(),u=0;u<o.length;++u){f=o[u],function(n){CodeMirror.on(f,"click",function(t){CodeMirror.e_preventDefault(t),l(),n&&n(c)})}(i[u]);CodeMirror.on(f,"blur",function(){--s,setTimeout(function(){s<=0&&l()},200)});CodeMirror.on(f,"focus",function(){++s})}})})(),function(){function s(n){return typeof n=="string"?{token:function(t){if(t.match(n))return"searching";t.next(),t.skipTo(n.charAt(0))||t.skipToEnd()}}:{token:function(t){if(t.match(n))return"searching";while(!t.eol())if(t.next(),t.match(n,!1))break}}}function h(){this.posFrom=this.posTo=this.query=null,this.overlay=null}function t(n){return n._searchState||(n._searchState=new h)}function n(n,t,i){return n.getSearchCursor(t,i,typeof t=="string"&&t==t.toLowerCase())}function i(n,t,i,r){n.openDialog?n.openDialog(t,r):r(prompt(i,""))}function c(n,t,i,r){n.openConfirm?n.openConfirm(t,r):confirm(i)&&r[0]()}function f(n){var t=n.match(/^\/(.*)\/([a-z]*)$/);return t?new RegExp(t[1],t[2].indexOf("i")==-1?"":"i"):n}function r(n,r){var u=t(n);if(u.query)return e(n,r);i(n,l,"Search for:",function(t){n.operation(function(){t&&!u.query&&(u.query=f(t),n.removeOverlay(u.overlay),u.overlay=s(t),n.addOverlay(u.overlay),u.posFrom=u.posTo=n.getCursor(),e(n,r))})})}function e(i,r){i.operation(function(){var f=t(i),u=n(i,f.query,r?f.posFrom:f.posTo);(u.find(r)||(u=n(i,f.query,r?CodeMirror.Pos(i.lastLine()):CodeMirror.Pos(i.firstLine(),0)),u.find(r)))&&(i.setSelection(u.from(),u.to()),f.posFrom=u.from(),f.posTo=u.to())})}function u(n){n.operation(function(){var i=t(n);i.query&&(i.query=null,n.removeOverlay(i.overlay))})}function o(t,r){i(t,a,"Replace:",function(e){e&&(e=f(e),i(t,v,"Replace with:",function(i){if(r)t.operation(function(){for(var u,r=n(t,e);r.findNext();)typeof e!="string"?(u=t.getRange(r.from(),r.to()).match(e),r.replace(i.replace(/\$(\d)/,function(n,t){return u[t]}))):r.replace(i)});else{u(t);var f=n(t,e,t.getCursor()),o=function(){var i=f.from(),r;((r=f.findNext())||(f=n(t,e),(r=f.findNext())&&(!i||f.from().line!=i.line||f.from().ch!=i.ch)))&&(t.setSelection(f.from(),f.to()),c(t,y,"Replace?",[function(){s(r)},o]))},s=function(n){f.replace(typeof e=="string"?i:i.replace(/\$(\d)/,function(t,i){return n[i]})),o()};o()}}))})}var l='Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)<\/span>',a='Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)<\/span>',v='With: <input type="text" style="width: 10em"/>',y="Replace? <button>Yes<\/button> <button>No<\/button> <button>Stop<\/button>";CodeMirror.commands.find=function(n){u(n),r(n)},CodeMirror.commands.findNext=r,CodeMirror.commands.findPrev=function(n){r(n,!0)},CodeMirror.commands.clearSearch=u,CodeMirror.commands.replace=o,CodeMirror.commands.replaceAll=function(n){o(n,!0)}}(),function(){function t(t,i,r,u){if(this.atOccurrence=!1,this.cm=t,u==null&&typeof i=="string"&&(u=!1),r=r?t.clipPos(r):n(0,0),this.pos={from:r,to:r},typeof i!="string")i.global||(i=new RegExp(i.source,i.ignoreCase?"ig":"g")),this.matches=function(r,u){var s;if(r){i.lastIndex=0;for(var e=t.getLine(u.line).slice(0,u.ch),f=i.exec(e),o=0;f;)if(o+=f.index+1,e=e.slice(o),i.lastIndex=0,s=i.exec(e),s)f=s;else break;o--}else{i.lastIndex=u.ch;var e=t.getLine(u.line),f=i.exec(e),o=f&&f.index}if(f&&f[0])return{from:n(u.line,o),to:n(u.line,o+f[0].length),match:f}};else{u&&(i=i.toLowerCase());var e=u?function(n){return n.toLowerCase()}:function(n){return n},f=i.split("\n");this.matches=f.length==1?i.length?function(r,u){var s=e(t.getLine(u.line)),o=i.length,f;if(r?u.ch>=o&&(f=s.lastIndexOf(i,u.ch-o))!=-1:(f=s.indexOf(i,u.ch))!=-1)return{from:n(u.line,f),to:n(u.line,f+o)}}:function(){}:function(i,r){var s=r.line,h=i?f.length-1:0,u=f[h],o=e(t.getLine(s)),c=i?o.indexOf(u)+u.length:o.lastIndexOf(u),l,a,v;if(!(i?c>=r.ch||c!=u.length:c<=r.ch||c!=o.length-u.length))for(;;){if(i?!s:s==t.lineCount()-1)return;if(o=e(t.getLine(s+=i?-1:1)),u=f[i?--h:++h],h>0&&h<f.length-1){if(o!=u)return;continue}return(l=i?o.lastIndexOf(u):o.indexOf(u)+u.length,i?l!=o.length-u.length:l!=u.length)?void 0:(a=n(r.line,c),v=n(s,l),{from:i?v:a,to:i?a:v})}}}}var n=CodeMirror.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(t){function f(t){var i=n(t,0);return u.pos={from:i,to:i},u.atOccurrence=!1,!1}for(var u=this,i=this.cm.clipPos(t?this.pos.from:this.pos.to),r;;){if(this.pos=this.matches(t,i))return this.pos.from&&this.pos.to||console.log(this.matches,this.pos),this.atOccurrence=!0,this.pos.match||!0;if(t){if(!i.line)return f(0);i=n(i.line-1,this.cm.getLine(i.line-1).length)}else{if(r=this.cm.lineCount(),i.line==r-1)return f(r);i=n(i.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(t){if(this.atOccurrence){var i=CodeMirror.splitLines(t);this.cm.replaceRange(i,this.pos.from,this.pos.to),this.pos.to=n(this.pos.from.line+i.length-1,i[i.length-1].length+(i.length==1?this.pos.from.ch:0))}}},CodeMirror.defineExtension("getSearchCursor",function(n,i,r){return new t(this,n,i,r)})}()
@@ -1,41 +0,0 @@
1
- /*
2
- Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
3
- For licensing, see LICENSE.html or http://ckeditor.com/license
4
- */
5
- (function(){var r=function(c,j){function r(){var a=arguments,b=this.getContentElement("advanced","txtdlgGenStyle");b&&b.commit.apply(b,a);this.foreach(function(b){b.commit&&"txtdlgGenStyle"!=b.id&&b.commit.apply(b,a)})}function i(a){if(!s){s=1;var b=this.getDialog(),d=b.imageElement;if(d){this.commit(f,d);for(var a=[].concat(a),e=a.length,c,g=0;g<e;g++)(c=b.getContentElement.apply(b,a[g].split(":")))&&c.setup(f,d)}s=0}}var f=1,k=/^\s*(\d+)((px)|\%)?\s*$/i,v=/(^\s*(\d+)((px)|\%)?\s*$)|^$/i,o=/^\d+px$/,
6
- w=function(){var a=this.getValue(),b=this.getDialog(),d=a.match(k);d&&("%"==d[2]&&l(b,!1),a=d[1]);b.lockRatio&&(d=b.originalElement,"true"==d.getCustomData("isReady")&&("txtHeight"==this.id?(a&&"0"!=a&&(a=Math.round(d.$.width*(a/d.$.height))),isNaN(a)||b.setValueOf("info","txtWidth",a)):(a&&"0"!=a&&(a=Math.round(d.$.height*(a/d.$.width))),isNaN(a)||b.setValueOf("info","txtHeight",a))));g(b)},g=function(a){if(!a.originalElement||!a.preview)return 1;a.commitContent(4,a.preview);return 0},s,l=function(a,
7
- b){if(!a.getContentElement("info","ratioLock"))return null;var d=a.originalElement;if(!d)return null;if("check"==b){if(!a.userlockRatio&&"true"==d.getCustomData("isReady")){var e=a.getValueOf("info","txtWidth"),c=a.getValueOf("info","txtHeight"),d=1E3*d.$.width/d.$.height,f=1E3*e/c;a.lockRatio=!1;!e&&!c?a.lockRatio=!0:!isNaN(d)&&!isNaN(f)&&Math.round(d)==Math.round(f)&&(a.lockRatio=!0)}}else void 0!=b?a.lockRatio=b:(a.userlockRatio=1,a.lockRatio=!a.lockRatio);e=CKEDITOR.document.getById(p);a.lockRatio?
8
- e.removeClass("cke_btn_unlocked"):e.addClass("cke_btn_unlocked");e.setAttribute("aria-checked",a.lockRatio);CKEDITOR.env.hc&&e.getChild(0).setHtml(a.lockRatio?CKEDITOR.env.ie?"■":"▣":CKEDITOR.env.ie?"□":"▢");return a.lockRatio},x=function(a){var b=a.originalElement;if("true"==b.getCustomData("isReady")){var d=a.getContentElement("info","txtWidth"),e=a.getContentElement("info","txtHeight");d&&d.setValue(b.$.width);e&&e.setValue(b.$.height)}g(a)},y=function(a,b){function d(a,b){var d=a.match(k);return d?
9
- ("%"==d[2]&&(d[1]+="%",l(e,!1)),d[1]):b}if(a==f){var e=this.getDialog(),c="",g="txtWidth"==this.id?"width":"height",h=b.getAttribute(g);h&&(c=d(h,c));c=d(b.getStyle(g),c);this.setValue(c)}},t,q=function(){var a=this.originalElement;a.setCustomData("isReady","true");a.removeListener("load",q);a.removeListener("error",h);a.removeListener("abort",h);CKEDITOR.document.getById(m).setStyle("display","none");this.dontResetSize||x(this);this.firstLoad&&CKEDITOR.tools.setTimeout(function(){l(this,"check")},
10
- 0,this);this.dontResetSize=this.firstLoad=!1},h=function(){var a=this.originalElement;a.removeListener("load",q);a.removeListener("error",h);a.removeListener("abort",h);a=CKEDITOR.getUrl(CKEDITOR.plugins.get("image").path+"images/noimage.png");this.preview&&this.preview.setAttribute("src",a);CKEDITOR.document.getById(m).setStyle("display","none");l(this,!1)},n=function(a){return CKEDITOR.tools.getNextId()+"_"+a},p=n("btnLockSizes"),u=n("btnResetSize"),m=n("ImagePreviewLoader"),A=n("previewLink"),
11
- z=n("previewImage");return{title:c.lang.image["image"==j?"title":"titleButton"],minWidth:420,minHeight:360,onShow:function(){this.linkEditMode=this.imageEditMode=this.linkElement=this.imageElement=!1;this.lockRatio=!0;this.userlockRatio=0;this.dontResetSize=!1;this.firstLoad=!0;this.addLink=!1;var a=this.getParentEditor(),b=a.getSelection(),d=(b=b&&b.getSelectedElement())&&a.elementPath(b).contains("a",1);CKEDITOR.document.getById(m).setStyle("display","none");t=new CKEDITOR.dom.element("img",a.document);
12
- this.preview=CKEDITOR.document.getById(z);this.originalElement=a.document.createElement("img");this.originalElement.setAttribute("alt","");this.originalElement.setCustomData("isReady","false");if(d){this.linkElement=d;this.linkEditMode=!0;var c=d.getChildren();if(1==c.count()){var g=c.getItem(0).getName();if("img"==g||"input"==g)this.imageElement=c.getItem(0),"img"==this.imageElement.getName()?this.imageEditMode="img":"input"==this.imageElement.getName()&&(this.imageEditMode="input")}"image"==j&&
13
- this.setupContent(2,d)}if(b&&"img"==b.getName()&&!b.data("cke-realelement")||b&&"input"==b.getName()&&"image"==b.getAttribute("type"))this.imageEditMode=b.getName(),this.imageElement=b;this.imageEditMode?(this.cleanImageElement=this.imageElement,this.imageElement=this.cleanImageElement.clone(!0,!0),this.setupContent(f,this.imageElement)):this.imageElement=a.document.createElement("img");l(this,!0);CKEDITOR.tools.trim(this.getValueOf("info","txtUrl"))||(this.preview.removeAttribute("src"),this.preview.setStyle("display",
14
- "none"))},onOk:function(){if(this.imageEditMode){var a=this.imageEditMode;"image"==j&&"input"==a&&confirm(c.lang.image.button2Img)?(this.imageElement=c.document.createElement("img"),this.imageElement.setAttribute("alt",""),c.insertElement(this.imageElement)):"image"!=j&&"img"==a&&confirm(c.lang.image.img2Button)?(this.imageElement=c.document.createElement("input"),this.imageElement.setAttributes({type:"image",alt:""}),c.insertElement(this.imageElement)):(this.imageElement=this.cleanImageElement,delete this.cleanImageElement)}else"image"==
15
- j?this.imageElement=c.document.createElement("img"):(this.imageElement=c.document.createElement("input"),this.imageElement.setAttribute("type","image")),this.imageElement.setAttribute("alt","");this.linkEditMode||(this.linkElement=c.document.createElement("a"));this.commitContent(f,this.imageElement);this.commitContent(2,this.linkElement);this.imageElement.getAttribute("style")||this.imageElement.removeAttribute("style");this.imageEditMode?!this.linkEditMode&&this.addLink?(c.insertElement(this.linkElement),
16
- this.imageElement.appendTo(this.linkElement)):this.linkEditMode&&!this.addLink&&(c.getSelection().selectElement(this.linkElement),c.insertElement(this.imageElement)):this.addLink?this.linkEditMode?c.insertElement(this.imageElement):(c.insertElement(this.linkElement),this.linkElement.append(this.imageElement,!1)):c.insertElement(this.imageElement)},onLoad:function(){"image"!=j&&this.hidePage("Link");var a=this._.element.getDocument();this.getContentElement("info","ratioLock")&&(this.addFocusable(a.getById(u),
17
- 5),this.addFocusable(a.getById(p),5));this.commitContent=r},onHide:function(){this.preview&&this.commitContent(8,this.preview);this.originalElement&&(this.originalElement.removeListener("load",q),this.originalElement.removeListener("error",h),this.originalElement.removeListener("abort",h),this.originalElement.remove(),this.originalElement=!1);delete this.imageElement},contents:[{id:"info",label:c.lang.image.infoTab,accessKey:"I",elements:[{type:"vbox",padding:0,children:[{type:"hbox",widths:["280px",
18
- "110px"],align:"right",children:[{id:"txtUrl",type:"text",label:c.lang.common.url,required:!0,onChange:function(){var a=this.getDialog(),b=this.getValue();if(0<b.length){var a=this.getDialog(),d=a.originalElement;a.preview.removeStyle("display");d.setCustomData("isReady","false");var c=CKEDITOR.document.getById(m);c&&c.setStyle("display","");d.on("load",q,a);d.on("error",h,a);d.on("abort",h,a);d.setAttribute("src",b);t.setAttribute("src",b);a.preview.setAttribute("src",t.$.src);g(a)}else a.preview&&
19
- (a.preview.removeAttribute("src"),a.preview.setStyle("display","none"))},setup:function(a,b){if(a==f){var d=b.data("cke-saved-src")||b.getAttribute("src");this.getDialog().dontResetSize=!0;this.setValue(d);this.setInitValue()}},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())?(b.data("cke-saved-src",this.getValue()),b.setAttribute("src",this.getValue())):8==a&&(b.setAttribute("src",""),b.removeAttribute("src"))},validate:CKEDITOR.dialog.validate.notEmpty(c.lang.image.urlMissing)},{type:"button",
20
- id:"browse",style:"display:inline-block;margin-top:10px;",align:"center",label:c.lang.common.browseServer,hidden:!0,filebrowser:"info:txtUrl"}]}]},{id:"txtAlt",type:"text",label:c.lang.image.alt,accessKey:"T","default":"",onChange:function(){g(this.getDialog())},setup:function(a,b){a==f&&this.setValue(b.getAttribute("alt"))},commit:function(a,b){a==f?(this.getValue()||this.isChanged())&&b.setAttribute("alt",this.getValue()):4==a?b.setAttribute("alt",this.getValue()):8==a&&b.removeAttribute("alt")}},
21
- {type:"hbox",children:[{id:"basic",type:"vbox",children:[{type:"hbox",widths:["50%","50%"],children:[{type:"vbox",padding:1,children:[{type:"text",width:"40px",id:"txtWidth",label:c.lang.common.width,onKeyUp:w,onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:function(){var a=this.getValue().match(v);(a=!!(a&&0!==parseInt(a[1],10)))||alert(c.lang.common.invalidWidth);return a},setup:y,commit:function(a,b,d){var c=this.getValue();a==f?(c?b.setStyle("width",CKEDITOR.tools.cssLength(c)):
22
- b.removeStyle("width"),!d&&b.removeAttribute("width")):4==a?c.match(k)?b.setStyle("width",CKEDITOR.tools.cssLength(c)):(a=this.getDialog().originalElement,"true"==a.getCustomData("isReady")&&b.setStyle("width",a.$.width+"px")):8==a&&(b.removeAttribute("width"),b.removeStyle("width"))}},{type:"text",id:"txtHeight",width:"40px",label:c.lang.common.height,onKeyUp:w,onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:function(){var a=this.getValue().match(v);(a=!!(a&&0!==parseInt(a[1],
23
- 10)))||alert(c.lang.common.invalidHeight);return a},setup:y,commit:function(a,b,d){var c=this.getValue();a==f?(c?b.setStyle("height",CKEDITOR.tools.cssLength(c)):b.removeStyle("height"),!d&&b.removeAttribute("height")):4==a?c.match(k)?b.setStyle("height",CKEDITOR.tools.cssLength(c)):(a=this.getDialog().originalElement,"true"==a.getCustomData("isReady")&&b.setStyle("height",a.$.height+"px")):8==a&&(b.removeAttribute("height"),b.removeStyle("height"))}}]},{id:"ratioLock",type:"html",style:"margin-top:30px;width:40px;height:40px;",
24
- onLoad:function(){var a=CKEDITOR.document.getById(u),b=CKEDITOR.document.getById(p);a&&(a.on("click",function(a){x(this);a.data&&a.data.preventDefault()},this.getDialog()),a.on("mouseover",function(){this.addClass("cke_btn_over")},a),a.on("mouseout",function(){this.removeClass("cke_btn_over")},a));b&&(b.on("click",function(a){l(this);var b=this.originalElement,c=this.getValueOf("info","txtWidth");if(b.getCustomData("isReady")=="true"&&c){b=b.$.height/b.$.width*c;if(!isNaN(b)){this.setValueOf("info",
25
- "txtHeight",Math.round(b));g(this)}}a.data&&a.data.preventDefault()},this.getDialog()),b.on("mouseover",function(){this.addClass("cke_btn_over")},b),b.on("mouseout",function(){this.removeClass("cke_btn_over")},b))},html:'<div><a href="javascript:void(0)" tabindex="-1" title="'+c.lang.image.lockRatio+'" class="cke_btn_locked" id="'+p+'" role="checkbox"><span class="cke_icon"></span><span class="cke_label">'+c.lang.image.lockRatio+'</span></a><a href="javascript:void(0)" tabindex="-1" title="'+c.lang.image.resetSize+
26
- '" class="cke_btn_reset" id="'+u+'" role="button"><span class="cke_label">'+c.lang.image.resetSize+"</span></a></div>"}]},{type:"vbox",padding:1,children:[{type:"text",id:"txtBorder",width:"60px",label:c.lang.image.border,"default":"",onKeyUp:function(){g(this.getDialog())},onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(c.lang.image.validateBorder),setup:function(a,b){if(a==f){var d;d=(d=(d=b.getStyle("border-width"))&&d.match(/^(\d+px)(?: \1 \1 \1)?$/))&&
27
- parseInt(d[1],10);isNaN(parseInt(d,10))&&(d=b.getAttribute("border"));this.setValue(d)}},commit:function(a,b,d){var c=parseInt(this.getValue(),10);a==f||4==a?(isNaN(c)?!c&&this.isChanged()&&b.removeStyle("border"):(b.setStyle("border-width",CKEDITOR.tools.cssLength(c)),b.setStyle("border-style","solid")),!d&&a==f&&b.removeAttribute("border")):8==a&&(b.removeAttribute("border"),b.removeStyle("border-width"),b.removeStyle("border-style"),b.removeStyle("border-color"))}},{type:"text",id:"txtHSpace",
28
- width:"60px",label:c.lang.image.hSpace,"default":"",onKeyUp:function(){g(this.getDialog())},onChange:function(){i.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(c.lang.image.validateHSpace),setup:function(a,b){if(a==f){var d,c;d=b.getStyle("margin-left");c=b.getStyle("margin-right");d=d&&d.match(o);c=c&&c.match(o);d=parseInt(d,10);c=parseInt(c,10);d=d==c&&d;isNaN(parseInt(d,10))&&(d=b.getAttribute("hspace"));this.setValue(d)}},commit:function(a,b,c){var e=parseInt(this.getValue(),
29
- 10);a==f||4==a?(isNaN(e)?!e&&this.isChanged()&&(b.removeStyle("margin-left"),b.removeStyle("margin-right")):(b.setStyle("margin-left",CKEDITOR.tools.cssLength(e)),b.setStyle("margin-right",CKEDITOR.tools.cssLength(e))),!c&&a==f&&b.removeAttribute("hspace")):8==a&&(b.removeAttribute("hspace"),b.removeStyle("margin-left"),b.removeStyle("margin-right"))}},{type:"text",id:"txtVSpace",width:"60px",label:c.lang.image.vSpace,"default":"",onKeyUp:function(){g(this.getDialog())},onChange:function(){i.call(this,
30
- "advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(c.lang.image.validateVSpace),setup:function(a,b){if(a==f){var c,e;c=b.getStyle("margin-top");e=b.getStyle("margin-bottom");c=c&&c.match(o);e=e&&e.match(o);c=parseInt(c,10);e=parseInt(e,10);c=c==e&&c;isNaN(parseInt(c,10))&&(c=b.getAttribute("vspace"));this.setValue(c)}},commit:function(a,b,c){var e=parseInt(this.getValue(),10);a==f||4==a?(isNaN(e)?!e&&this.isChanged()&&(b.removeStyle("margin-top"),b.removeStyle("margin-bottom")):
31
- (b.setStyle("margin-top",CKEDITOR.tools.cssLength(e)),b.setStyle("margin-bottom",CKEDITOR.tools.cssLength(e))),!c&&a==f&&b.removeAttribute("vspace")):8==a&&(b.removeAttribute("vspace"),b.removeStyle("margin-top"),b.removeStyle("margin-bottom"))}},{id:"cmbAlign",type:"select",widths:["35%","65%"],style:"width:90px",label:c.lang.common.align,"default":"",items:[[c.lang.common.notSet,""],[c.lang.common.alignLeft,"left"],[c.lang.common.alignRight,"right"]],onChange:function(){g(this.getDialog());i.call(this,
32
- "advanced:txtdlgGenStyle")},setup:function(a,b){if(a==f){var c=b.getStyle("float");switch(c){case "inherit":case "none":c=""}!c&&(c=(b.getAttribute("align")||"").toLowerCase());this.setValue(c)}},commit:function(a,b,c){var e=this.getValue();if(a==f||4==a){if(e?b.setStyle("float",e):b.removeStyle("float"),!c&&a==f)switch(e=(b.getAttribute("align")||"").toLowerCase(),e){case "left":case "right":b.removeAttribute("align")}}else 8==a&&b.removeStyle("float")}}]}]},{type:"vbox",height:"250px",children:[{type:"html",
33
- id:"htmlPreview",style:"width:95%;",html:"<div>"+CKEDITOR.tools.htmlEncode(c.lang.common.preview)+'<br><div id="'+m+'" class="ImagePreviewLoader" style="display:none"><div class="loading">&nbsp;</div></div><div class="ImagePreviewBox"><table><tr><td><a href="javascript:void(0)" target="_blank" onclick="return false;" id="'+A+'"><img id="'+z+'" alt="" /></a>'+(c.config.image_previewText||"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.")+
34
- "</td></tr></table></div></div>"}]}]}]},{id:"Link",label:c.lang.image.linkTab,padding:0,elements:[{id:"txtUrl",type:"text",label:c.lang.common.url,style:"width: 100%","default":"",setup:function(a,b){if(2==a){var c=b.data("cke-saved-href");c||(c=b.getAttribute("href"));this.setValue(c)}},commit:function(a,b){if(2==a&&(this.getValue()||this.isChanged())){var d=decodeURI(this.getValue());b.data("cke-saved-href",d);b.setAttribute("href",d);if(this.getValue()||!c.config.image_removeLinkByEmptyURL)this.getDialog().addLink=
35
- !0}}},{type:"button",id:"browse",filebrowser:{action:"Browse",target:"Link:txtUrl",url:c.config.filebrowserImageBrowseLinkUrl},style:"float:right",hidden:!0,label:c.lang.common.browseServer},{id:"cmbTarget",type:"select",label:c.lang.common.target,"default":"",items:[[c.lang.common.notSet,""],[c.lang.common.targetNew,"_blank"],[c.lang.common.targetTop,"_top"],[c.lang.common.targetSelf,"_self"],[c.lang.common.targetParent,"_parent"]],setup:function(a,b){2==a&&this.setValue(b.getAttribute("target")||
36
- "")},commit:function(a,b){2==a&&(this.getValue()||this.isChanged())&&b.setAttribute("target",this.getValue())}}]},{id:"Upload",hidden:!0,filebrowser:"uploadButton",label:c.lang.image.upload,elements:[{type:"file",id:"upload",label:c.lang.image.btnUpload,style:"height:40px",size:38},{type:"fileButton",id:"uploadButton",filebrowser:"info:txtUrl",label:c.lang.image.btnUpload,"for":["Upload","upload"]}]},{id:"advanced",label:c.lang.common.advancedTab,elements:[{type:"hbox",widths:["50%","25%","25%"],
37
- children:[{type:"text",id:"linkId",label:c.lang.common.id,setup:function(a,b){a==f&&this.setValue(b.getAttribute("id"))},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("id",this.getValue())}},{id:"cmbLangDir",type:"select",style:"width : 100px;",label:c.lang.common.langDir,"default":"",items:[[c.lang.common.notSet,""],[c.lang.common.langDirLtr,"ltr"],[c.lang.common.langDirRtl,"rtl"]],setup:function(a,b){a==f&&this.setValue(b.getAttribute("dir"))},commit:function(a,
38
- b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("dir",this.getValue())}},{type:"text",id:"txtLangCode",label:c.lang.common.langCode,"default":"",setup:function(a,b){a==f&&this.setValue(b.getAttribute("lang"))},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("lang",this.getValue())}}]},{type:"text",id:"txtGenLongDescr",label:c.lang.common.longDescr,setup:function(a,b){a==f&&this.setValue(b.getAttribute("longDesc"))},commit:function(a,b){a==f&&(this.getValue()||
39
- this.isChanged())&&b.setAttribute("longDesc",this.getValue())}},{type:"hbox",widths:["50%","50%"],children:[{type:"text",id:"txtGenClass",label:c.lang.common.cssClass,"default":"",setup:function(a,b){a==f&&this.setValue(b.getAttribute("class"))},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("class",this.getValue())}},{type:"text",id:"txtGenTitle",label:c.lang.common.advisoryTitle,"default":"",onChange:function(){g(this.getDialog())},setup:function(a,b){a==f&&this.setValue(b.getAttribute("title"))},
40
- commit:function(a,b){a==f?(this.getValue()||this.isChanged())&&b.setAttribute("title",this.getValue()):4==a?b.setAttribute("title",this.getValue()):8==a&&b.removeAttribute("title")}}]},{type:"text",id:"txtdlgGenStyle",label:c.lang.common.cssStyle,validate:CKEDITOR.dialog.validate.inlineStyle(c.lang.common.invalidInlineStyle),"default":"",setup:function(a,b){if(a==f){var c=b.getAttribute("style");!c&&b.$.style.cssText&&(c=b.$.style.cssText);this.setValue(c);var e=b.$.style.height,c=b.$.style.width,
41
- e=(e?e:"").match(k),c=(c?c:"").match(k);this.attributesInStyle={height:!!e,width:!!c}}},onChange:function(){i.call(this,"info:cmbFloat info:cmbAlign info:txtVSpace info:txtHSpace info:txtBorder info:txtWidth info:txtHeight".split(" "));g(this)},commit:function(a,b){a==f&&(this.getValue()||this.isChanged())&&b.setAttribute("style",this.getValue())}}]}]}};CKEDITOR.dialog.add("image",function(c){return r(c,"image")});CKEDITOR.dialog.add("imagebutton",function(c){return r(c,"imagebutton")})})();