@sync-in/server 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/CHANGELOG.md +173 -58
  2. package/environment/environment.dist.yaml +6 -3
  3. package/migrations/0003_giant_luckman.sql +6 -0
  4. package/migrations/meta/0003_snapshot.json +2463 -0
  5. package/migrations/meta/_journal.json +7 -0
  6. package/package.json +19 -17
  7. package/server/app.bootstrap.js +5 -2
  8. package/server/app.bootstrap.js.map +1 -1
  9. package/server/app.constants.js +0 -4
  10. package/server/app.constants.js.map +1 -1
  11. package/server/app.service.js +7 -6
  12. package/server/app.service.js.map +1 -1
  13. package/server/applications/files/constants/only-office.js +12 -0
  14. package/server/applications/files/constants/only-office.js.map +1 -1
  15. package/server/applications/files/files.config.js +5 -0
  16. package/server/applications/files/files.config.js.map +1 -1
  17. package/server/applications/files/files.controller.js +12 -4
  18. package/server/applications/files/files.controller.js.map +1 -1
  19. package/server/applications/files/files.controller.spec.js +18 -4
  20. package/server/applications/files/files.controller.spec.js.map +1 -1
  21. package/server/applications/files/services/files-content-manager.service.js +6 -6
  22. package/server/applications/files/services/files-content-manager.service.js.map +1 -1
  23. package/server/applications/files/services/files-manager.service.js +4 -4
  24. package/server/applications/files/services/files-manager.service.js.map +1 -1
  25. package/server/applications/files/services/files-methods.service.js +4 -7
  26. package/server/applications/files/services/files-methods.service.js.map +1 -1
  27. package/server/applications/files/services/files-only-office-manager.service.js +2 -2
  28. package/server/applications/files/services/files-only-office-manager.service.js.map +1 -1
  29. package/server/applications/files/services/files-parser.service.js +6 -3
  30. package/server/applications/files/services/files-parser.service.js.map +1 -1
  31. package/server/applications/files/services/files-scheduler.service.js +51 -3
  32. package/server/applications/files/services/files-scheduler.service.js.map +1 -1
  33. package/server/applications/files/services/files-search-manager.service.js +4 -0
  34. package/server/applications/files/services/files-search-manager.service.js.map +1 -1
  35. package/server/applications/files/utils/doc-textify/adapters/pdf.js +6 -8
  36. package/server/applications/files/utils/doc-textify/adapters/pdf.js.map +1 -1
  37. package/server/applications/notifications/i18n/de.js +56 -0
  38. package/server/applications/notifications/i18n/de.js.map +1 -0
  39. package/server/applications/notifications/i18n/es.js +52 -0
  40. package/server/applications/notifications/i18n/es.js.map +1 -0
  41. package/server/applications/notifications/i18n/hi.js +52 -0
  42. package/server/applications/notifications/i18n/hi.js.map +1 -0
  43. package/server/applications/notifications/i18n/index.js +73 -8
  44. package/server/applications/notifications/i18n/index.js.map +1 -1
  45. package/server/applications/notifications/i18n/it.js +52 -0
  46. package/server/applications/notifications/i18n/it.js.map +1 -0
  47. package/server/applications/notifications/i18n/ja.js +52 -0
  48. package/server/applications/notifications/i18n/ja.js.map +1 -0
  49. package/server/applications/notifications/i18n/ko.js +52 -0
  50. package/server/applications/notifications/i18n/ko.js.map +1 -0
  51. package/server/applications/notifications/i18n/pl.js +52 -0
  52. package/server/applications/notifications/i18n/pl.js.map +1 -0
  53. package/server/applications/notifications/i18n/pt.js +52 -0
  54. package/server/applications/notifications/i18n/pt.js.map +1 -0
  55. package/server/applications/notifications/i18n/pt_br.js +52 -0
  56. package/server/applications/notifications/i18n/pt_br.js.map +1 -0
  57. package/server/applications/notifications/i18n/ru.js +52 -0
  58. package/server/applications/notifications/i18n/ru.js.map +1 -0
  59. package/server/applications/notifications/i18n/tr.js +52 -0
  60. package/server/applications/notifications/i18n/tr.js.map +1 -0
  61. package/server/applications/notifications/i18n/zh.js +52 -0
  62. package/server/applications/notifications/i18n/zh.js.map +1 -0
  63. package/server/applications/notifications/mails/models.js +6 -7
  64. package/server/applications/notifications/mails/models.js.map +1 -1
  65. package/server/applications/notifications/services/notifications-manager.service.js.map +1 -1
  66. package/server/applications/shares/dto/create-or-update-share.dto.js +11 -0
  67. package/server/applications/shares/dto/create-or-update-share.dto.js.map +1 -1
  68. package/server/applications/shares/interfaces/share-props.interface.js.map +1 -1
  69. package/server/applications/shares/schemas/share.interface.js.map +1 -1
  70. package/server/applications/shares/schemas/shares.schema.js +9 -0
  71. package/server/applications/shares/schemas/shares.schema.js.map +1 -1
  72. package/server/applications/shares/services/shares-manager.service.js +46 -17
  73. package/server/applications/shares/services/shares-manager.service.js.map +1 -1
  74. package/server/applications/shares/services/shares-queries.service.js +24 -5
  75. package/server/applications/shares/services/shares-queries.service.js.map +1 -1
  76. package/server/applications/spaces/constants/cache.js +4 -0
  77. package/server/applications/spaces/constants/cache.js.map +1 -1
  78. package/server/applications/spaces/dto/create-or-update-space.dto.js +5 -0
  79. package/server/applications/spaces/dto/create-or-update-space.dto.js.map +1 -1
  80. package/server/applications/spaces/guards/space.guard.js +3 -3
  81. package/server/applications/spaces/guards/space.guard.js.map +1 -1
  82. package/server/applications/spaces/models/space-props.model.js.map +1 -1
  83. package/server/applications/spaces/models/space.model.js.map +1 -1
  84. package/server/applications/spaces/schemas/space.interface.js.map +1 -1
  85. package/server/applications/spaces/schemas/spaces.schema.js +1 -0
  86. package/server/applications/spaces/schemas/spaces.schema.js.map +1 -1
  87. package/server/applications/spaces/services/spaces-browser.service.js.map +1 -1
  88. package/server/applications/spaces/services/spaces-manager.service.js +34 -31
  89. package/server/applications/spaces/services/spaces-manager.service.js.map +1 -1
  90. package/server/applications/spaces/services/spaces-queries.service.js +23 -7
  91. package/server/applications/spaces/services/spaces-queries.service.js.map +1 -1
  92. package/server/applications/spaces/services/spaces-scheduler.service.js +21 -20
  93. package/server/applications/spaces/services/spaces-scheduler.service.js.map +1 -1
  94. package/server/applications/spaces/spaces.controller.js +4 -2
  95. package/server/applications/spaces/spaces.controller.js.map +1 -1
  96. package/server/applications/spaces/utils/paths.js +14 -16
  97. package/server/applications/spaces/utils/paths.js.map +1 -1
  98. package/server/applications/sync/services/sync-manager.service.js +4 -3
  99. package/server/applications/sync/services/sync-manager.service.js.map +1 -1
  100. package/server/applications/sync/services/sync-paths-manager.service.js +1 -1
  101. package/server/applications/sync/services/sync-paths-manager.service.js.map +1 -1
  102. package/server/applications/sync/services/sync-paths-manager.service.spec.js +1 -1
  103. package/server/applications/sync/services/sync-paths-manager.service.spec.js.map +1 -1
  104. package/server/applications/sync/sync.controller.js +2 -1
  105. package/server/applications/sync/sync.controller.js.map +1 -1
  106. package/server/applications/users/constants/routes.js +5 -0
  107. package/server/applications/users/constants/routes.js.map +1 -1
  108. package/server/applications/users/constants/user.js +0 -16
  109. package/server/applications/users/constants/user.js.map +1 -1
  110. package/server/applications/users/dto/user-properties.dto.js +10 -0
  111. package/server/applications/users/dto/user-properties.dto.js.map +1 -1
  112. package/server/applications/users/models/user.model.js.map +1 -1
  113. package/server/applications/users/schemas/user.interface.js.map +1 -1
  114. package/server/applications/users/schemas/users.schema.js +3 -2
  115. package/server/applications/users/schemas/users.schema.js.map +1 -1
  116. package/server/applications/users/services/admin-users-manager.service.js +1 -0
  117. package/server/applications/users/services/admin-users-manager.service.js.map +1 -1
  118. package/server/applications/users/services/admin-users-manager.service.spec.js +2 -1
  119. package/server/applications/users/services/admin-users-manager.service.spec.js.map +1 -1
  120. package/server/applications/users/services/users-manager.service.js +7 -2
  121. package/server/applications/users/services/users-manager.service.js.map +1 -1
  122. package/server/applications/users/services/users-manager.service.spec.js +1 -0
  123. package/server/applications/users/services/users-manager.service.spec.js.map +1 -1
  124. package/server/applications/users/services/users-queries.service.js +18 -4
  125. package/server/applications/users/services/users-queries.service.js.map +1 -1
  126. package/server/applications/users/users.controller.js +15 -0
  127. package/server/applications/users/users.controller.js.map +1 -1
  128. package/server/applications/users/users.gateway.js +6 -0
  129. package/server/applications/users/users.gateway.js.map +1 -1
  130. package/server/applications/users/utils/test.js +2 -2
  131. package/server/applications/users/utils/test.js.map +1 -1
  132. package/server/applications/webdav/constants/routes.js +2 -2
  133. package/server/applications/webdav/constants/routes.js.map +1 -1
  134. package/server/applications/webdav/constants/webdav.js +2 -2
  135. package/server/applications/webdav/constants/webdav.js.map +1 -1
  136. package/server/applications/webdav/filters/webdav.filter.js +2 -2
  137. package/server/applications/webdav/filters/webdav.filter.js.map +1 -1
  138. package/server/applications/webdav/filters/webdav.filter.spec.js +2 -2
  139. package/server/applications/webdav/filters/webdav.filter.spec.js.map +1 -1
  140. package/server/applications/webdav/services/webdav-methods.service.js +3 -2
  141. package/server/applications/webdav/services/webdav-methods.service.js.map +1 -1
  142. package/server/applications/webdav/utils/webdav.js +1 -2
  143. package/server/applications/webdav/utils/webdav.js.map +1 -1
  144. package/server/authentication/auth.config.js +2 -2
  145. package/server/authentication/auth.config.js.map +1 -1
  146. package/server/authentication/guards/auth-basic.strategy.js +2 -2
  147. package/server/authentication/guards/auth-basic.strategy.js.map +1 -1
  148. package/server/common/i18n.js +52 -0
  149. package/server/common/i18n.js.map +1 -0
  150. package/server/common/image.js +63 -43
  151. package/server/common/image.js.map +1 -1
  152. package/server/common/interfaces.js.map +1 -1
  153. package/server/common/shared.js +5 -2
  154. package/server/common/shared.js.map +1 -1
  155. package/server/configuration/config.validation.js +3 -3
  156. package/server/configuration/config.validation.js.map +1 -1
  157. package/server/infrastructure/cache/adapters/mysql-cache.adapter.js +8 -6
  158. package/server/infrastructure/cache/adapters/mysql-cache.adapter.js.map +1 -1
  159. package/server/infrastructure/cache/adapters/redis-cache.adapter.js +22 -17
  160. package/server/infrastructure/cache/adapters/redis-cache.adapter.js.map +1 -1
  161. package/server/infrastructure/cache/cache.e2e-spec.js +1 -0
  162. package/server/infrastructure/cache/cache.e2e-spec.js.map +1 -1
  163. package/server/infrastructure/cache/cache.module.js +1 -14
  164. package/server/infrastructure/cache/cache.module.js.map +1 -1
  165. package/server/infrastructure/cache/services/cache.service.js.map +1 -1
  166. package/server/infrastructure/database/database.module.js +20 -1
  167. package/server/infrastructure/database/database.module.js.map +1 -1
  168. package/server/infrastructure/database/utils.js +48 -0
  169. package/server/infrastructure/database/utils.js.map +1 -1
  170. package/server/infrastructure/scheduler/scheduler.module.js +1 -1
  171. package/server/infrastructure/scheduler/scheduler.module.js.map +1 -1
  172. package/server/infrastructure/websocket/adapters/cluster.adapter.js +1 -3
  173. package/server/infrastructure/websocket/adapters/cluster.adapter.js.map +1 -1
  174. package/static/3rdpartylicenses.txt +137 -163
  175. package/static/chunk-2KLC4T2Z.js +1 -0
  176. package/static/chunk-2VMSXRCB.js +12 -0
  177. package/static/chunk-3GMLWAFZ.js +1 -0
  178. package/static/chunk-3OHSRRKH.js +4 -0
  179. package/static/chunk-3R4WKOHQ.js +1 -0
  180. package/static/{chunk-7ITZXYYJ.js → chunk-3R74L4UU.js} +1 -1
  181. package/static/chunk-3XVM35O2.js +1 -0
  182. package/static/chunk-3YVRP3VM.js +2 -0
  183. package/static/chunk-5NMSIIQB.js +1 -0
  184. package/static/chunk-5UKZLU5H.js +1 -0
  185. package/static/chunk-AF24EYXU.js +1 -0
  186. package/static/chunk-AKQVEHO6.js +2 -0
  187. package/static/chunk-BCVX464U.js +2 -0
  188. package/static/chunk-BQV4FRM6.js +1 -0
  189. package/static/{chunk-EVIE5F2U.js → chunk-CETH7UYS.js} +1 -1
  190. package/static/chunk-CHJ64RJM.js +1 -0
  191. package/static/chunk-DIT6W7VM.js +562 -0
  192. package/static/chunk-DKSEQTMX.js +1 -0
  193. package/static/chunk-DM4NXKEP.js +1 -0
  194. package/static/chunk-DPUVSXRB.js +1 -0
  195. package/static/chunk-DSWEWLXJ.js +1 -0
  196. package/static/chunk-FJE6BOFL.js +1 -0
  197. package/static/chunk-FZ3JPGYZ.js +1 -0
  198. package/static/chunk-IQSKQXC3.js +1 -0
  199. package/static/chunk-ITUFI2BJ.js +1 -0
  200. package/static/chunk-JPT5WEAT.js +1 -0
  201. package/static/chunk-LCTZJ537.js +1 -0
  202. package/static/chunk-LK2UCQJ6.js +1 -0
  203. package/static/chunk-LNTUR3GU.js +1 -0
  204. package/static/chunk-LP5TBXEN.js +7 -0
  205. package/static/{chunk-IPAC4VAF.js → chunk-LVSNIS5P.js} +1 -1
  206. package/static/{chunk-SIPE37PA.js → chunk-MTVSJTIW.js} +1 -1
  207. package/static/chunk-N3U6637P.js +1 -0
  208. package/static/chunk-NNV4OXSB.js +1 -0
  209. package/static/chunk-O6FYXVHI.js +1 -0
  210. package/static/chunk-OOGP4WSH.js +2 -0
  211. package/static/chunk-PB4AIT7O.js +1 -0
  212. package/static/chunk-PCWDQPOM.js +2 -0
  213. package/static/chunk-PNR6M34W.js +1 -0
  214. package/static/chunk-PVDHBQRM.js +1 -0
  215. package/static/chunk-Q5KM7LTX.js +1 -0
  216. package/static/chunk-QHC6ZPQ4.js +1 -0
  217. package/static/chunk-QMRBZHE4.js +1 -0
  218. package/static/chunk-QO6BTONN.js +1 -0
  219. package/static/chunk-QSJRY3TF.js +1 -0
  220. package/static/chunk-QUUIRSYT.js +1 -0
  221. package/static/chunk-RFH46UW3.js +1 -0
  222. package/static/{chunk-PTGDOWV3.js → chunk-RSXHRKM5.js} +1 -1
  223. package/static/chunk-RV3VZJPZ.js +1 -0
  224. package/static/{chunk-QNJFQVYI.js → chunk-S7HNXVRB.js} +1 -1
  225. package/static/chunk-SBZ572Q4.js +2 -0
  226. package/static/chunk-SJR5R3Y4.js +1 -0
  227. package/static/chunk-SLHTEGRU.js +1 -0
  228. package/static/{chunk-SH5EVL4E.js → chunk-SSFF27P2.js} +1 -1
  229. package/static/chunk-UNCPXHHT.js +1 -0
  230. package/static/chunk-URHTCJ7G.js +1 -0
  231. package/static/chunk-V3LHHZYN.js +1 -0
  232. package/static/{chunk-DJYJ66UF.js → chunk-VJTXJ43D.js} +1 -1
  233. package/static/chunk-VQQKMY2C.js +1 -0
  234. package/static/{chunk-IQOALFYU.js → chunk-WSSU2HXE.js} +1 -1
  235. package/static/chunk-XDZGW64M.js +3 -0
  236. package/static/chunk-XTRDKGKG.js +1 -0
  237. package/static/chunk-YLWTEC3X.js +1 -0
  238. package/static/chunk-Z5J5F5SX.js +1 -0
  239. package/static/chunk-ZIJQRARU.js +1 -0
  240. package/static/index.html +2 -2
  241. package/static/main-4H5BJY3J.js +9 -0
  242. package/static/scripts-WRDOQIU5.js +24 -0
  243. package/static/{styles-A5VYX3CE.css → styles-2C2UNCNB.css} +1 -1
  244. package/server/applications/spaces/interfaces/space-quota.interface.js +0 -10
  245. package/server/applications/spaces/interfaces/space-quota.interface.js.map +0 -1
  246. package/static/chunk-22EANI6R.js +0 -1
  247. package/static/chunk-3GFGJYMK.js +0 -1
  248. package/static/chunk-4YGJGZZZ.js +0 -1
  249. package/static/chunk-5K7HEX3C.js +0 -27
  250. package/static/chunk-5KLMS6A4.js +0 -1
  251. package/static/chunk-ATP3BFHV.js +0 -562
  252. package/static/chunk-BB4G55KE.js +0 -1
  253. package/static/chunk-EWKSX76T.js +0 -1
  254. package/static/chunk-FHLACA7V.js +0 -1
  255. package/static/chunk-GCATNU55.js +0 -1
  256. package/static/chunk-GYODPCIE.js +0 -1
  257. package/static/chunk-HZTFYLM5.js +0 -1
  258. package/static/chunk-JSUKJT6Z.js +0 -1
  259. package/static/chunk-JXZCNFW7.js +0 -1
  260. package/static/chunk-LTGFCQR7.js +0 -1
  261. package/static/chunk-LV3PYKWO.js +0 -1
  262. package/static/chunk-N2WFNW6M.js +0 -7
  263. package/static/chunk-ORMRCEGT.js +0 -1
  264. package/static/chunk-OUTBJSMW.js +0 -1
  265. package/static/chunk-RS2PX32L.js +0 -1
  266. package/static/chunk-RSSWH3S2.js +0 -1
  267. package/static/chunk-RTRJ3KFH.js +0 -1
  268. package/static/chunk-TKTCBDOG.js +0 -1
  269. package/static/chunk-V6K2N46L.js +0 -1
  270. package/static/chunk-XLCCZSQL.js +0 -4
  271. package/static/chunk-YPEH66GG.js +0 -1
  272. package/static/chunk-YPOIUQ57.js +0 -1
  273. package/static/chunk-ZKCFO2OA.js +0 -4
  274. package/static/main-MZ7HWZXO.js +0 -9
  275. package/static/scripts-VZVAP2P4.js +0 -30
@@ -1,30 +0,0 @@
1
- /*! Hammer.JS - v2.0.7 - 2016-04-22
2
- * http://hammerjs.github.io/
3
- *
4
- * Copyright (c) 2016 Jorik Tangelder;
5
- * Licensed under the MIT license */(function(k,j,Q,G){"use strict";function R(f,h,p){return setTimeout(Ue(f,p),h)}function C(f,h,p){return Array.isArray(f)?(M(f,p[h],p),!0):!1}function M(f,h,p){var m;if(f)if(f.forEach)f.forEach(h,p);else if(f.length!==G)for(m=0;m<f.length;)h.call(p,f[m],m,f),m++;else for(m in f)f.hasOwnProperty(m)&&h.call(p,f[m],m,f)}function z(f,h,p){var m="DEPRECATED METHOD: "+h+`
6
- `+p+` AT
7
- `;return function(){var S=new Error("get-stack-trace"),P=S&&S.stack?S.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",B=k.console&&(k.console.warn||k.console.log);return B&&B.call(k.console,m,P),f.apply(this,arguments)}}function q(f,h,p){var m,S=h.prototype;m=f.prototype=Object.create(S),m.constructor=f,m._super=S,p&&Ve(m,p)}function Ue(f,h){return function(){return f.apply(h,arguments)}}function se(f,h){return typeof f==gr?f.apply(h&&h[0]||G,h):f}function Se(f,h){return f===G?h:f}function ne(f,h,p){M(ht(h),function(m){f.addEventListener(m,p,!1)})}function Tt(f,h,p){M(ht(h),function(m){f.removeEventListener(m,p,!1)})}function Ui(f,h){for(;f;){if(f==h)return!0;f=f.parentNode}return!1}function Lt(f,h){return f.indexOf(h)>-1}function ht(f){return f.trim().split(/\s+/g)}function rt(f,h,p){if(f.indexOf&&!p)return f.indexOf(h);for(var m=0;m<f.length;){if(p&&f[m][p]==h||!p&&f[m]===h)return m;m++}return-1}function ct(f){return Array.prototype.slice.call(f,0)}function Ae(f,h,p){for(var m=[],S=[],P=0;P<f.length;){var B=h?f[P][h]:f[P];rt(S,B)<0&&m.push(f[P]),S[P]=B,P++}return p&&(m=h?m.sort(function(J,je){return J[h]>je[h]}):m.sort()),m}function Ar(f,h){for(var p,m,S=h[0].toUpperCase()+h.slice(1),P=0;P<Jt.length;){if(p=Jt[P],m=p?p+S:h,m in f)return m;P++}return G}function Mn(){return hi++}function dt(f){var h=f.ownerDocument||f;return h.defaultView||h.parentWindow||k}function Oe(f,h){var p=this;this.manager=f,this.callback=h,this.element=f.element,this.target=f.options.inputTarget,this.domHandler=function(m){se(f.options.enable,[f])&&p.handler(m)},this.init()}function ni(f){var h,p=f.options.inputClass;return new(h=p||(le?mt:Xi?Kt:$?ke:gt))(f,Yt)}function Yt(f,h,p){var m=p.pointers.length,S=p.changedPointers.length,P=h&ae&&m-S===0,B=h&(te|Me)&&m-S===0;p.isFirst=!!P,p.isFinal=!!B,P&&(f.session={}),p.eventType=h,kt(f,p),f.emit("hammer.input",p),f.recognize(p),f.session.prevInput=p}function kt(f,h){var p=f.session,m=h.pointers,S=m.length;p.firstInput||(p.firstInput=E(h)),S>1&&!p.firstMultiple?p.firstMultiple=E(h):S===1&&(p.firstMultiple=!1);var P=p.firstInput,B=p.firstMultiple,J=B?B.center:P.center,je=h.center=Mt(m);h.timeStamp=Ye(),h.deltaTime=h.timeStamp-P.timeStamp,h.angle=nt(J,je),h.distance=we(J,je),pt(p,h),h.offsetDirection=it(h.deltaX,h.deltaY);var Ie=vt(h.deltaTime,h.deltaX,h.deltaY);h.overallVelocityX=Ie.x,h.overallVelocityY=Ie.y,h.overallVelocity=At(Ie.x)>At(Ie.y)?Ie.x:Ie.y,h.scale=B?pr(B.pointers,m):1,h.rotation=B?oi(B.pointers,m):0,h.maxPointers=p.prevInput?h.pointers.length>p.prevInput.maxPointers?h.pointers.length:p.prevInput.maxPointers:h.pointers.length,Ee(p,h);var Ze=f.element;Ui(h.srcEvent.target,Ze)&&(Ze=h.srcEvent.target),h.target=Ze}function pt(f,h){var p=h.center,m=f.offsetDelta||{},S=f.prevDelta||{},P=f.prevInput||{};h.eventType!==ae&&P.eventType!==te||(S=f.prevDelta={x:P.deltaX||0,y:P.deltaY||0},m=f.offsetDelta={x:p.x,y:p.y}),h.deltaX=S.x+(p.x-m.x),h.deltaY=S.y+(p.y-m.y)}function Ee(f,h){var p,m,S,P,B=f.lastInterval||h,J=h.timeStamp-B.timeStamp;if(h.eventType!=Me&&(J>ci||B.velocity===G)){var je=h.deltaX-B.deltaX,Ie=h.deltaY-B.deltaY,Ze=vt(J,je,Ie);m=Ze.x,S=Ze.y,p=At(Ze.x)>At(Ze.y)?Ze.x:Ze.y,P=it(je,Ie),f.lastInterval=h}else p=B.velocity,m=B.velocityX,S=B.velocityY,P=B.direction;h.velocity=p,h.velocityX=m,h.velocityY=S,h.direction=P}function E(f){for(var h=[],p=0;p<f.pointers.length;)h[p]={clientX:$e(f.pointers[p].clientX),clientY:$e(f.pointers[p].clientY)},p++;return{timeStamp:Ye(),pointers:h,center:Mt(h),deltaX:f.deltaX,deltaY:f.deltaY}}function Mt(f){var h=f.length;if(h===1)return{x:$e(f[0].clientX),y:$e(f[0].clientY)};for(var p=0,m=0,S=0;h>S;)p+=f[S].clientX,m+=f[S].clientY,S++;return{x:$e(p/h),y:$e(m/h)}}function vt(f,h,p){return{x:h/f||0,y:p/f||0}}function it(f,h){return f===h?$t:At(f)>=At(h)?0>f?mr:Ot:0>h?yr:Et}function we(f,h,p){p||(p=Ki);var m=h[p[0]]-f[p[0]],S=h[p[1]]-f[p[1]];return Math.sqrt(m*m+S*S)}function nt(f,h,p){p||(p=Ki);var m=h[p[0]]-f[p[0]],S=h[p[1]]-f[p[1]];return 180*Math.atan2(S,m)/Math.PI}function oi(f,h){return nt(h[1],h[0],er)+nt(f[1],f[0],er)}function pr(f,h){return we(h[0],h[1],er)/we(f[0],f[1],er)}function gt(){this.evEl=Nn,this.evWin=An,this.pressed=!1,Oe.apply(this,arguments)}function mt(){this.evEl=Wt,this.evWin=ji,Oe.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function yt(){this.evTarget=pi,this.evWin=Zi,this.started=!1,Oe.apply(this,arguments)}function Or(f,h){var p=ct(f.touches),m=ct(f.changedTouches);return h&(te|Me)&&(p=Ae(p.concat(m),"identifier",!0)),[p,m]}function Kt(){this.evTarget=A,this.targetIds={},Oe.apply(this,arguments)}function Dt(f,h){var p=ct(f.touches),m=this.targetIds;if(h&(ae|ot)&&p.length===1)return m[p[0].identifier]=!0,[p,p];var S,P,B=ct(f.changedTouches),J=[],je=this.target;if(P=p.filter(function(Ie){return Ui(Ie.target,je)}),h===ae)for(S=0;S<P.length;)m[P[S].identifier]=!0,S++;for(S=0;S<B.length;)m[B[S].identifier]&&J.push(B[S]),h&(te|Me)&&delete m[B[S].identifier],S++;return J.length?[Ae(P.concat(J),"identifier",!0),J]:void 0}function ke(){Oe.apply(this,arguments);var f=Ue(this.handler,this);this.touch=new Kt(this.manager,f),this.mouse=new gt(this.manager,f),this.primaryTouch=null,this.lastTouches=[]}function xt(f,h){f&ae?(this.primaryTouch=h.changedPointers[0].identifier,he.call(this,h)):f&(te|Me)&&he.call(this,h)}function he(f){var h=f.changedPointers[0];if(h.identifier===this.primaryTouch){var p={x:h.clientX,y:h.clientY};this.lastTouches.push(p);var m=this.lastTouches,S=function(){var P=m.indexOf(p);P>-1&&m.splice(P,1)};setTimeout(S,It)}}function _i(f){for(var h=f.srcEvent.clientX,p=f.srcEvent.clientY,m=0;m<this.lastTouches.length;m++){var S=this.lastTouches[m],P=Math.abs(h-S.x),B=Math.abs(p-S.y);if(Rr>=P&&Rr>=B)return!0}return!1}function jt(f,h){this.manager=f,this.set(h)}function Je(f){if(Lt(f,b))return b;var h=Lt(f,F),p=Lt(f,Ft);return h&&p?b:h||p?h?F:Ft:Lt(f,xr)?xr:rr}function si(){if(!X)return!1;var f={},h=k.CSS&&k.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(p){f[p]=h?k.CSS.supports("touch-action",p):!0}),f}function Pe(f){this.options=Ve({},this.defaults,f||{}),this.id=Mn(),this.manager=null,this.options.enable=Se(this.options.enable,!0),this.state=Rt,this.simultaneous={},this.requireFail=[]}function Er(f){return f&nr?"cancel":f&H?"end":f&zt?"move":f&Ce?"start":""}function vr(f){return f==Et?"down":f==yr?"up":f==mr?"left":f==Ot?"right":""}function Zt(f,h){var p=h.manager;return p?p.get(f):f}function U(){Pe.apply(this,arguments)}function Nt(){U.apply(this,arguments),this.pX=null,this.pY=null}function li(){U.apply(this,arguments)}function Pr(){Pe.apply(this,arguments),this._timer=null,this._input=null}function Wr(){U.apply(this,arguments)}function ai(){U.apply(this,arguments)}function Qt(){Pe.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function _e(f,h){return h=h||{},h.recognizers=Se(h.recognizers,_e.defaults.preset),new Hr(f,h)}function Hr(f,h){this.options=Ve({},_e.defaults,h||{}),this.options.inputTarget=this.options.inputTarget||f,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=f,this.input=ni(this),this.touchAction=new jt(this,this.options.touchAction),qi(this,!0),M(this.options.recognizers,function(p){var m=this.add(new p[0](p[1]));p[2]&&m.recognizeWith(p[2]),p[3]&&m.requireFailure(p[3])},this)}function qi(f,h){var p=f.element;if(p.style){var m;M(f.options.cssProps,function(S,P){m=Ar(p.style,P),h?(f.oldCssProps[m]=p.style[m],p.style[m]=S):p.style[m]=f.oldCssProps[m]||""}),h||(f.oldCssProps={})}}function ui(f,h){var p=j.createEvent("Event");p.initEvent(f,!0,!0),p.gesture=h,h.target.dispatchEvent(p)}var Ve,Jt=["","webkit","Moz","MS","ms","o"],Dn=j.createElement("div"),gr="function",$e=Math.round,At=Math.abs,Ye=Date.now;Ve=typeof Object.assign!="function"?function(f){if(f===G||f===null)throw new TypeError("Cannot convert undefined or null to object");for(var h=Object(f),p=1;p<arguments.length;p++){var m=arguments[p];if(m!==G&&m!==null)for(var S in m)m.hasOwnProperty(S)&&(h[S]=m[S])}return h}:Object.assign;var fi=z(function(f,h,p){for(var m=Object.keys(h),S=0;S<m.length;)(!p||p&&f[m[S]]===G)&&(f[m[S]]=h[m[S]]),S++;return f},"extend","Use `assign`."),I=z(function(f,h){return fi(f,h,!0)},"merge","Use `assign`."),hi=1,We=/mobile|tablet|ip(ad|hone|od)|android/i,$="ontouchstart"in k,le=Ar(k,"PointerEvent")!==G,Xi=$&&We.test(navigator.userAgent),xe="touch",Vt="pen",de="mouse",Yi="kinect",ci=25,ae=1,ot=2,te=4,Me=8,$t=1,mr=2,Ot=4,yr=8,Et=16,et=mr|Ot,Pt=yr|Et,Ir=et|Pt,Ki=["x","y"],er=["clientX","clientY"];Oe.prototype={handler:function(){},init:function(){this.evEl&&ne(this.element,this.evEl,this.domHandler),this.evTarget&&ne(this.target,this.evTarget,this.domHandler),this.evWin&&ne(dt(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&Tt(this.element,this.evEl,this.domHandler),this.evTarget&&Tt(this.target,this.evTarget,this.domHandler),this.evWin&&Tt(dt(this.element),this.evWin,this.domHandler)}};var tr={mousedown:ae,mousemove:ot,mouseup:te},Nn="mousedown",An="mousemove mouseup";q(gt,Oe,{handler:function(f){var h=tr[f.type];h&ae&&f.button===0&&(this.pressed=!0),h&ot&&f.which!==1&&(h=te),this.pressed&&(h&te&&(this.pressed=!1),this.callback(this.manager,h,{pointers:[f],changedPointers:[f],pointerType:de,srcEvent:f}))}});var Fr={pointerdown:ae,pointermove:ot,pointerup:te,pointercancel:Me,pointerout:Me},di={2:xe,3:Vt,4:de,5:Yi},Wt="pointerdown",ji="pointermove pointerup pointercancel";k.MSPointerEvent&&!k.PointerEvent&&(Wt="MSPointerDown",ji="MSPointerMove MSPointerUp MSPointerCancel"),q(mt,Oe,{handler:function(f){var h=this.store,p=!1,m=f.type.toLowerCase().replace("ms",""),S=Fr[m],P=di[f.pointerType]||f.pointerType,B=P==xe,J=rt(h,f.pointerId,"pointerId");S&ae&&(f.button===0||B)?0>J&&(h.push(f),J=h.length-1):S&(te|Me)&&(p=!0),0>J||(h[J]=f,this.callback(this.manager,S,{pointers:h,changedPointers:[f],pointerType:P,srcEvent:f}),p&&h.splice(J,1))}});var Ht={touchstart:ae,touchmove:ot,touchend:te,touchcancel:Me},pi="touchstart",Zi="touchstart touchmove touchend touchcancel";q(yt,Oe,{handler:function(f){var h=Ht[f.type];if(h===ae&&(this.started=!0),this.started){var p=Or.call(this,f,h);h&(te|Me)&&p[0].length-p[1].length===0&&(this.started=!1),this.callback(this.manager,h,{pointers:p[0],changedPointers:p[1],pointerType:xe,srcEvent:f})}}});var re={touchstart:ae,touchmove:ot,touchend:te,touchcancel:Me},A="touchstart touchmove touchend touchcancel";q(Kt,Oe,{handler:function(f){var h=re[f.type],p=Dt.call(this,f,h);p&&this.callback(this.manager,h,{pointers:p[0],changedPointers:p[1],pointerType:xe,srcEvent:f})}});var It=2500,Rr=25;q(ke,Oe,{handler:function(f,h,p){var m=p.pointerType==xe,S=p.pointerType==de;if(!(S&&p.sourceCapabilities&&p.sourceCapabilities.firesTouchEvents)){if(m)xt.call(this,h,p);else if(S&&_i.call(this,p))return;this.callback(f,h,p)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Ke=Ar(Dn.style,"touchAction"),X=Ke!==G,bt="compute",rr="auto",xr="manipulation",b="none",F="pan-x",Ft="pan-y",ir=si();jt.prototype={set:function(f){f==bt&&(f=this.compute()),X&&this.manager.element.style&&ir[f]&&(this.manager.element.style[Ke]=f),this.actions=f.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var f=[];return M(this.manager.recognizers,function(h){se(h.options.enable,[h])&&(f=f.concat(h.getTouchAction()))}),Je(f.join(" "))},preventDefaults:function(f){var h=f.srcEvent,p=f.offsetDirection;if(this.manager.session.prevented)return void h.preventDefault();var m=this.actions,S=Lt(m,b)&&!ir[b],P=Lt(m,Ft)&&!ir[Ft],B=Lt(m,F)&&!ir[F];if(S){var J=f.pointers.length===1,je=f.distance<2,Ie=f.deltaTime<250;if(J&&je&&Ie)return}return B&&P?void 0:S||P&&p&et||B&&p&Pt?this.preventSrc(h):void 0},preventSrc:function(f){this.manager.session.prevented=!0,f.preventDefault()}};var Rt=1,Ce=2,zt=4,H=8,st=H,nr=16,He=32;Pe.prototype={defaults:{},set:function(f){return Ve(this.options,f),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(f){if(C(f,"recognizeWith",this))return this;var h=this.simultaneous;return f=Zt(f,this),h[f.id]||(h[f.id]=f,f.recognizeWith(this)),this},dropRecognizeWith:function(f){return C(f,"dropRecognizeWith",this)?this:(f=Zt(f,this),delete this.simultaneous[f.id],this)},requireFailure:function(f){if(C(f,"requireFailure",this))return this;var h=this.requireFail;return f=Zt(f,this),rt(h,f)===-1&&(h.push(f),f.requireFailure(this)),this},dropRequireFailure:function(f){if(C(f,"dropRequireFailure",this))return this;f=Zt(f,this);var h=rt(this.requireFail,f);return h>-1&&this.requireFail.splice(h,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(f){return!!this.simultaneous[f.id]},emit:function(f){function h(S){p.manager.emit(S,f)}var p=this,m=this.state;H>m&&h(p.options.event+Er(m)),h(p.options.event),f.additionalEvent&&h(f.additionalEvent),m>=H&&h(p.options.event+Er(m))},tryEmit:function(f){return this.canEmit()?this.emit(f):void(this.state=He)},canEmit:function(){for(var f=0;f<this.requireFail.length;){if(!(this.requireFail[f].state&(He|Rt)))return!1;f++}return!0},recognize:function(f){var h=Ve({},f);return se(this.options.enable,[this,h])?(this.state&(st|nr|He)&&(this.state=Rt),this.state=this.process(h),void(this.state&(Ce|zt|H|nr)&&this.tryEmit(h))):(this.reset(),void(this.state=He))},process:function(f){},getTouchAction:function(){},reset:function(){}},q(U,Pe,{defaults:{pointers:1},attrTest:function(f){var h=this.options.pointers;return h===0||f.pointers.length===h},process:function(f){var h=this.state,p=f.eventType,m=h&(Ce|zt),S=this.attrTest(f);return m&&(p&Me||!S)?h|nr:m||S?p&te?h|H:h&Ce?h|zt:Ce:He}}),q(Nt,U,{defaults:{event:"pan",threshold:10,pointers:1,direction:Ir},getTouchAction:function(){var f=this.options.direction,h=[];return f&et&&h.push(Ft),f&Pt&&h.push(F),h},directionTest:function(f){var h=this.options,p=!0,m=f.distance,S=f.direction,P=f.deltaX,B=f.deltaY;return S&h.direction||(h.direction&et?(S=P===0?$t:0>P?mr:Ot,p=P!=this.pX,m=Math.abs(f.deltaX)):(S=B===0?$t:0>B?yr:Et,p=B!=this.pY,m=Math.abs(f.deltaY))),f.direction=S,p&&m>h.threshold&&S&h.direction},attrTest:function(f){return U.prototype.attrTest.call(this,f)&&(this.state&Ce||!(this.state&Ce)&&this.directionTest(f))},emit:function(f){this.pX=f.deltaX,this.pY=f.deltaY;var h=vr(f.direction);h&&(f.additionalEvent=this.options.event+h),this._super.emit.call(this,f)}}),q(li,U,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[b]},attrTest:function(f){return this._super.attrTest.call(this,f)&&(Math.abs(f.scale-1)>this.options.threshold||this.state&Ce)},emit:function(f){if(f.scale!==1){var h=f.scale<1?"in":"out";f.additionalEvent=this.options.event+h}this._super.emit.call(this,f)}}),q(Pr,Pe,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[rr]},process:function(f){var h=this.options,p=f.pointers.length===h.pointers,m=f.distance<h.threshold,S=f.deltaTime>h.time;if(this._input=f,!m||!p||f.eventType&(te|Me)&&!S)this.reset();else if(f.eventType&ae)this.reset(),this._timer=R(function(){this.state=st,this.tryEmit()},h.time,this);else if(f.eventType&te)return st;return He},reset:function(){clearTimeout(this._timer)},emit:function(f){this.state===st&&(f&&f.eventType&te?this.manager.emit(this.options.event+"up",f):(this._input.timeStamp=Ye(),this.manager.emit(this.options.event,this._input)))}}),q(Wr,U,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[b]},attrTest:function(f){return this._super.attrTest.call(this,f)&&(Math.abs(f.rotation)>this.options.threshold||this.state&Ce)}}),q(ai,U,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:et|Pt,pointers:1},getTouchAction:function(){return Nt.prototype.getTouchAction.call(this)},attrTest:function(f){var h,p=this.options.direction;return p&(et|Pt)?h=f.overallVelocity:p&et?h=f.overallVelocityX:p&Pt&&(h=f.overallVelocityY),this._super.attrTest.call(this,f)&&p&f.offsetDirection&&f.distance>this.options.threshold&&f.maxPointers==this.options.pointers&&At(h)>this.options.velocity&&f.eventType&te},emit:function(f){var h=vr(f.offsetDirection);h&&this.manager.emit(this.options.event+h,f),this.manager.emit(this.options.event,f)}}),q(Qt,Pe,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[xr]},process:function(f){var h=this.options,p=f.pointers.length===h.pointers,m=f.distance<h.threshold,S=f.deltaTime<h.time;if(this.reset(),f.eventType&ae&&this.count===0)return this.failTimeout();if(m&&S&&p){if(f.eventType!=te)return this.failTimeout();var P=this.pTime?f.timeStamp-this.pTime<h.interval:!0,B=!this.pCenter||we(this.pCenter,f.center)<h.posThreshold;this.pTime=f.timeStamp,this.pCenter=f.center,B&&P?this.count+=1:this.count=1,this._input=f;var J=this.count%h.taps;if(J===0)return this.hasRequireFailures()?(this._timer=R(function(){this.state=st,this.tryEmit()},h.interval,this),Ce):st}return He},failTimeout:function(){return this._timer=R(function(){this.state=He},this.options.interval,this),He},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==st&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),_e.VERSION="2.0.7",_e.defaults={domEvents:!1,touchAction:bt,enable:!0,inputTarget:null,inputClass:null,preset:[[Wr,{enable:!1}],[li,{enable:!1},["rotate"]],[ai,{direction:et}],[Nt,{direction:et},["swipe"]],[Qt],[Qt,{event:"doubletap",taps:2},["tap"]],[Pr]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var tt=1,vi=2;Hr.prototype={set:function(f){return Ve(this.options,f),f.touchAction&&this.touchAction.update(),f.inputTarget&&(this.input.destroy(),this.input.target=f.inputTarget,this.input.init()),this},stop:function(f){this.session.stopped=f?vi:tt},recognize:function(f){var h=this.session;if(!h.stopped){this.touchAction.preventDefaults(f);var p,m=this.recognizers,S=h.curRecognizer;(!S||S&&S.state&st)&&(S=h.curRecognizer=null);for(var P=0;P<m.length;)p=m[P],h.stopped===vi||S&&p!=S&&!p.canRecognizeWith(S)?p.reset():p.recognize(f),!S&&p.state&(Ce|zt|H)&&(S=h.curRecognizer=p),P++}},get:function(f){if(f instanceof Pe)return f;for(var h=this.recognizers,p=0;p<h.length;p++)if(h[p].options.event==f)return h[p];return null},add:function(f){if(C(f,"add",this))return this;var h=this.get(f.options.event);return h&&this.remove(h),this.recognizers.push(f),f.manager=this,this.touchAction.update(),f},remove:function(f){if(C(f,"remove",this))return this;if(f=this.get(f)){var h=this.recognizers,p=rt(h,f);p!==-1&&(h.splice(p,1),this.touchAction.update())}return this},on:function(f,h){if(f!==G&&h!==G){var p=this.handlers;return M(ht(f),function(m){p[m]=p[m]||[],p[m].push(h)}),this}},off:function(f,h){if(f!==G){var p=this.handlers;return M(ht(f),function(m){h?p[m]&&p[m].splice(rt(p[m],h),1):delete p[m]}),this}},emit:function(f,h){this.options.domEvents&&ui(f,h);var p=this.handlers[f]&&this.handlers[f].slice();if(p&&p.length){h.type=f,h.preventDefault=function(){h.srcEvent.preventDefault()};for(var m=0;m<p.length;)p[m](h),m++}},destroy:function(){this.element&&qi(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},Ve(_e,{INPUT_START:ae,INPUT_MOVE:ot,INPUT_END:te,INPUT_CANCEL:Me,STATE_POSSIBLE:Rt,STATE_BEGAN:Ce,STATE_CHANGED:zt,STATE_ENDED:H,STATE_RECOGNIZED:st,STATE_CANCELLED:nr,STATE_FAILED:He,DIRECTION_NONE:$t,DIRECTION_LEFT:mr,DIRECTION_RIGHT:Ot,DIRECTION_UP:yr,DIRECTION_DOWN:Et,DIRECTION_HORIZONTAL:et,DIRECTION_VERTICAL:Pt,DIRECTION_ALL:Ir,Manager:Hr,Input:Oe,TouchAction:jt,TouchInput:Kt,MouseInput:gt,PointerEventInput:mt,TouchMouseInput:ke,SingleTouchInput:yt,Recognizer:Pe,AttrRecognizer:U,Tap:Qt,Pan:Nt,Swipe:ai,Pinch:li,Rotate:Wr,Press:Pr,on:ne,off:Tt,each:M,merge:I,extend:fi,assign:Ve,inherit:q,bindFn:Ue,prefixed:Ar});var Qi=typeof k<"u"?k:typeof self<"u"?self:{};Qi.Hammer=_e,typeof define=="function"&&define.amd?define(function(){return _e}):typeof module<"u"&&module.exports?module.exports=_e:k[Q]=_e})(window,document,"Hammer"),(function(k,j){typeof exports=="object"&&typeof module<"u"?module.exports=j():typeof define=="function"&&define.amd?define(j):(k=k||self,k.CodeMirror=j())})(this,(function(){"use strict";var k=navigator.userAgent,j=navigator.platform,Q=/gecko\/\d/i.test(k),G=/MSIE \d/.test(k),R=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(k),C=/Edge\/(\d+)/.exec(k),M=G||R||C,z=M&&(G?document.documentMode||6:+(C||R)[1]),q=!C&&/WebKit\//.test(k),Ue=q&&/Qt\/\d+\.\d+/.test(k),se=!C&&/Chrome\/(\d+)/.exec(k),Se=se&&+se[1],ne=/Opera\//.test(k),Tt=/Apple Computer/.test(navigator.vendor),Ui=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(k),Lt=/PhantomJS/.test(k),ht=Tt&&(/Mobile\/\w+/.test(k)||navigator.maxTouchPoints>2),rt=/Android/.test(k),ct=ht||rt||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(k),Ae=ht||/Mac/.test(j),Ar=/\bCrOS\b/.test(k),Mn=/win/i.test(j),dt=ne&&k.match(/Version\/(\d*\.\d*)/);dt&&(dt=Number(dt[1])),dt&&dt>=15&&(ne=!1,q=!0);var Oe=Ae&&(Ue||ne&&(dt==null||dt<12.11)),ni=Q||M&&z>=9;function Yt(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var kt=function(e,t){var i=e.className,r=Yt(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function pt(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ee(e,t){return pt(e).appendChild(t)}function E(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)n.appendChild(t[o]);return n}function Mt(e,t,i,r){var n=E(e,t,i,r);return n.setAttribute("role","presentation"),n}var vt;document.createRange?vt=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:vt=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function it(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function we(e){var t=e.ownerDocument||e,i;try{i=e.activeElement}catch{i=t.body||null}for(;i&&i.shadowRoot&&i.shadowRoot.activeElement;)i=i.shadowRoot.activeElement;return i}function nt(e,t){var i=e.className;Yt(t).test(i)||(e.className+=(i?" ":"")+t)}function oi(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!Yt(i[r]).test(t)&&(t+=" "+i[r]);return t}var pr=function(e){e.select()};ht?pr=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:M&&(pr=function(e){try{e.select()}catch{}});function gt(e){return e.display.wrapper.ownerDocument}function mt(e){return yt(e.display.wrapper)}function yt(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function Or(e){return gt(e).defaultView}function Kt(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Dt(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function ke(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=r||0,s=n||0;;){var l=e.indexOf(" ",o);if(l<0||l>=t)return s+(t-o);s+=l-o,s+=i-s%i,o=l+1}}var xt=function(){this.id=null,this.f=null,this.time=0,this.handler=Kt(this.onTimeout,this)};xt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},xt.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function he(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var _i=50,jt={toString:function(){return"CodeMirror.Pass"}},Je={scroll:!1},si={origin:"*mouse"},Pe={origin:"+move"};function Er(e,t,i){for(var r=0,n=0;;){var o=e.indexOf(" ",r);o==-1&&(o=e.length);var s=o-r;if(o==e.length||n+s>=t)return r+Math.min(s,t-n);if(n+=o-r,n+=i-n%i,r=o+1,n>=t)return r}}var vr=[""];function Zt(e){for(;vr.length<=e;)vr.push(U(vr)+" ");return vr[e]}function U(e){return e[e.length-1]}function Nt(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function li(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function Pr(){}function Wr(e,t){var i;return Object.create?i=Object.create(e):(Pr.prototype=e,i=new Pr),t&&Dt(t,i),i}var ai=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Qt(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ai.test(e))}function _e(e,t){return t?t.source.indexOf("\\w")>-1&&Qt(e)?!0:t.test(e):Qt(e)}function Hr(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qi=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ui(e){return e.charCodeAt(0)>=768&&qi.test(e)}function Ve(e,t,i){for(;(i<0?t>0:t<e.length)&&ui(e.charAt(t));)t+=i;return t}function Jt(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,o=r<0?Math.ceil(n):Math.floor(n);if(o==t)return e(o)?t:i;e(o)?i=o:t=o+r}}function Dn(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,o=0;o<e.length;++o){var s=e[o];(s.from<i&&s.to>t||t==i&&s.to==t)&&(r(Math.max(s.from,t),Math.min(s.to,i),s.level==1?"rtl":"ltr",o),n=!0)}n||r(t,i,"ltr")}var gr=null;function $e(e,t,i){var r;gr=null;for(var n=0;n<e.length;++n){var o=e[n];if(o.from<t&&o.to>t)return n;o.to==t&&(o.from!=o.to&&i=="before"?r=n:gr=n),o.from==t&&(o.from!=o.to&&i!="before"?r=n:gr=n)}return r??gr}var At=(function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,o=/[LRr]/,s=/[Lb1n]/,l=/[1n]/;function a(u,c,d){this.level=u,this.from=c,this.to=d}return function(u,c){var d=c=="ltr"?"L":"R";if(u.length==0||c=="ltr"&&!r.test(u))return!1;for(var g=u.length,v=[],y=0;y<g;++y)v.push(i(u.charCodeAt(y)));for(var x=0,w=d;x<g;++x){var T=v[x];T=="m"?v[x]=w:w=T}for(var D=0,L=d;D<g;++D){var N=v[D];N=="1"&&L=="r"?v[D]="n":o.test(N)&&(L=N,N=="r"&&(v[D]="R"))}for(var W=1,O=v[0];W<g-1;++W){var _=v[W];_=="+"&&O=="1"&&v[W+1]=="1"?v[W]="1":_==","&&O==v[W+1]&&(O=="1"||O=="n")&&(v[W]=O),O=_}for(var Z=0;Z<g;++Z){var me=v[Z];if(me==",")v[Z]="N";else if(me=="%"){var ee=void 0;for(ee=Z+1;ee<g&&v[ee]=="%";++ee);for(var Xe=Z&&v[Z-1]=="!"||ee<g&&v[ee]=="1"?"1":"N",ze=Z;ze<ee;++ze)v[ze]=Xe;Z=ee-1}}for(var ue=0,Be=d;ue<g;++ue){var be=v[ue];Be=="L"&&be=="1"?v[ue]="L":o.test(be)&&(Be=be)}for(var ce=0;ce<g;++ce)if(n.test(v[ce])){var fe=void 0;for(fe=ce+1;fe<g&&n.test(v[fe]);++fe);for(var ie=(ce?v[ce-1]:d)=="L",Ge=(fe<g?v[fe]:d)=="L",ri=ie==Ge?ie?"L":"R":d,dr=ce;dr<fe;++dr)v[dr]=ri;ce=fe-1}for(var Le=[],Ct,ye=0;ye<g;)if(s.test(v[ye])){var So=ye;for(++ye;ye<g&&s.test(v[ye]);++ye);Le.push(new a(0,So,ye))}else{var Xt=ye,Dr=Le.length,Nr=c=="rtl"?1:0;for(++ye;ye<g&&v[ye]!="L";++ye);for(var Ne=Xt;Ne<ye;)if(l.test(v[Ne])){Xt<Ne&&(Le.splice(Dr,0,new a(1,Xt,Ne)),Dr+=Nr);var ii=Ne;for(++Ne;Ne<ye&&l.test(v[Ne]);++Ne);Le.splice(Dr,0,new a(2,ii,Ne)),Dr+=Nr,Xt=Ne}else++Ne;Xt<ye&&Le.splice(Dr,0,new a(1,Xt,ye))}return c=="ltr"&&(Le[0].level==1&&(Ct=u.match(/^\s+/))&&(Le[0].from=Ct[0].length,Le.unshift(new a(0,0,Ct[0].length))),U(Le).level==1&&(Ct=u.match(/\s+$/))&&(U(Le).to-=Ct[0].length,Le.push(new a(0,g-Ct[0].length,g)))),c=="rtl"?Le.reverse():Le}})();function Ye(e,t){var i=e.order;return i==null&&(i=e.order=At(e.text,t)),i}var fi=[],I=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||fi).concat(i)}};function hi(e,t){return e._handlers&&e._handlers[t]||fi}function We(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var o=he(n,i);o>-1&&(r[t]=n.slice(0,o).concat(n.slice(o+1)))}}}function $(e,t){var i=hi(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function le(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),$(e,i||t.type,e,t),ci(t)||t.codemirrorIgnore}function Xi(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)he(i,t[r])==-1&&i.push(t[r])}function xe(e,t){return hi(e,t).length>0}function Vt(e){e.prototype.on=function(t,i){I(this,t,i)},e.prototype.off=function(t,i){We(this,t,i)}}function de(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Yi(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ci(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ae(e){de(e),Yi(e)}function ot(e){return e.target||e.srcElement}function te(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),Ae&&e.ctrlKey&&t==1&&(t=3),t}var Me=(function(){if(M&&z<9)return!1;var e=E("div");return"draggable"in e||"dragDrop"in e})(),$t;function mr(e){if($t==null){var t=E("span","\u200B");Ee(e,E("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&($t=t.offsetWidth<=1&&t.offsetHeight>2&&!(M&&z<8))}var i=$t?E("span","\u200B"):E("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Ot;function yr(e){if(Ot!=null)return Ot;var t=Ee(e,document.createTextNode("A\u062EA")),i=vt(t,0,1).getBoundingClientRect(),r=vt(t,1,2).getBoundingClientRect();return pt(e),!i||i.left==i.right?!1:Ot=r.right-i.right<3}var Et=`
8
-
9
- b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
10
- `,t);n==-1&&(n=e.length);var o=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),s=o.indexOf("\r");s!=-1?(i.push(o.slice(0,s)),t+=s+1):(i.push(o),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},et=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Pt=(function(){var e=E("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")})(),Ir=null;function Ki(e){if(Ir!=null)return Ir;var t=Ee(e,E("span","x")),i=t.getBoundingClientRect(),r=vt(t,0,1).getBoundingClientRect();return Ir=Math.abs(i.left-r.left)>1}var er={},tr={};function Nn(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),er[e]=t}function An(e,t){tr[e]=t}function Fr(e){if(typeof e=="string"&&tr.hasOwnProperty(e))e=tr[e];else if(e&&typeof e.name=="string"&&tr.hasOwnProperty(e.name)){var t=tr[e.name];typeof t=="string"&&(t={name:t}),e=Wr(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Fr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Fr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function di(e,t){t=Fr(t);var i=er[t.name];if(!i)return di(e,"text/plain");var r=i(e,t);if(Wt.hasOwnProperty(t.name)){var n=Wt[t.name];for(var o in n)n.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=n[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var s in t.modeProps)r[s]=t.modeProps[s];return r}var Wt={};function ji(e,t){var i=Wt.hasOwnProperty(e)?Wt[e]:Wt[e]={};Dt(t,i)}function Ht(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function pi(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Zi(e,t,i){return e.startState?e.startState(t,i):!0}var re=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};re.prototype.eol=function(){return this.pos>=this.string.length},re.prototype.sol=function(){return this.pos==this.lineStart},re.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},re.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},re.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},re.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},re.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},re.prototype.skipToEnd=function(){this.pos=this.string.length},re.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},re.prototype.backUp=function(e){this.pos-=e},re.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ke(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ke(this.string,this.lineStart,this.tabSize):0)},re.prototype.indentation=function(){return ke(this.string,null,this.tabSize)-(this.lineStart?ke(this.string,this.lineStart,this.tabSize):0)},re.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(s){return i?s.toLowerCase():s},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var o=this.string.slice(this.pos).match(e);return o&&o.index>0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},re.prototype.current=function(){return this.string.slice(this.start,this.pos)},re.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},re.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},re.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function A(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],o=n.chunkSize();if(t<o){i=n;break}t-=o}return i.lines[t]}function It(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(o){var s=o.text;n==i.line&&(s=s.slice(0,i.ch)),n==t.line&&(s=s.slice(t.ch)),r.push(s),++n}),r}function Rr(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function Ke(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function X(e){if(e.parent==null)return null;for(var t=e.parent,i=he(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;r.children[n]!=t;++n)i+=r.children[n].chunkSize();return i+t.first}function bt(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],o=n.height;if(t<o){e=n;continue e}t-=o,i+=n.chunkSize()}return i}while(!e.lines);for(var s=0;s<e.lines.length;++s){var l=e.lines[s],a=l.height;if(t<a)break;t-=a}return i+s}function rr(e,t){return t>=e.first&&t<e.first+e.size}function xr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function b(e,t,i){if(i===void 0&&(i=null),!(this instanceof b))return new b(e,t,i);this.line=e,this.ch=t,this.sticky=i}function F(e,t){return e.line-t.line||e.ch-t.ch}function Ft(e,t){return e.sticky==t.sticky&&F(e,t)==0}function ir(e){return b(e.line,e.ch)}function Rt(e,t){return F(e,t)<0?t:e}function Ce(e,t){return F(e,t)<0?e:t}function zt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function H(e,t){if(t.line<e.first)return b(e.first,0);var i=e.first+e.size-1;return t.line>i?b(i,A(e,i).text.length):st(t,A(e,t.line).text.length)}function st(e,t){var i=e.ch;return i==null||i>t?b(e.line,t):i<0?b(e.line,0):e}function nr(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=H(e,t[r]);return i}var He=function(e,t){this.state=e,this.lookAhead=t},tt=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};tt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},tt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},tt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},tt.fromSaved=function(e,t,i){return t instanceof He?new tt(e,Ht(e.mode,t.state),i,t.lookAhead):new tt(e,Ht(e.mode,t),i)},tt.prototype.save=function(e){var t=e!==!1?Ht(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new He(t,this.maxLookAhead):t};function vi(e,t,i,r){var n=[e.state.modeGen],o={};J(e,t.text,e.doc.mode,i,function(u,c){return n.push(u,c)},o,r);for(var s=i.state,l=function(u){i.baseTokens=n;var c=e.state.overlays[u],d=1,g=0;i.state=!0,J(e,t.text,c.mode,i,function(v,y){for(var x=d;g<v;){var w=n[d];w>v&&n.splice(d,1,v,n[d+1],w),d+=2,g=Math.min(v,w)}if(y)if(c.opaque)n.splice(x,d-x,v,"overlay "+y),d=x+2;else for(;x<d;x+=2){var T=n[x+1];n[x+1]=(T?T+" ":"")+"overlay "+y}},o),i.state=s,i.baseTokens=null,i.baseTokenPos=1},a=0;a<e.state.overlays.length;++a)l(a);return{styles:n,classes:o.bgClass||o.textClass?o:null}}function Qi(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=f(e,X(t)),n=t.text.length>e.options.maxHighlightLength&&Ht(e.doc.mode,r.state),o=vi(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function f(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new tt(r,!0,t);var o=je(e,t,i),s=o>r.first&&A(r,o-1).stateAfter,l=s?tt.fromSaved(r,s,o):new tt(r,Zi(r.mode),o);return r.iter(o,t,function(a){h(e,a.text,l);var u=l.line;a.stateAfter=u==t-1||u%5==0||u>=n.viewFrom&&u<n.viewTo?l.save():null,l.nextLine()}),i&&(r.modeFrontier=l.line),l}function h(e,t,i,r){var n=e.doc.mode,o=new re(t,e.options.tabSize,i);for(o.start=o.pos=r||0,t==""&&p(n,i.state);!o.eol();)m(n,o,i.state),o.start=o.pos}function p(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var i=pi(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}}function m(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=pi(e,i).mode);var o=e.token(t,i);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var S=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function P(e,t,i,r){var n=e.doc,o=n.mode,s;t=H(n,t);var l=A(n,t.line),a=f(e,t.line,i),u=new re(l.text,e.options.tabSize,a),c;for(r&&(c=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,s=m(o,u,a.state),r&&c.push(new S(u,s,Ht(n.mode,a.state)));return r?c:new S(u,s,a.state)}function B(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function J(e,t,i,r,n,o,s){var l=i.flattenSpans;l==null&&(l=e.options.flattenSpans);var a=0,u=null,c=new re(t,e.options.tabSize,r),d,g=e.options.addModeClass&&[null];for(t==""&&B(p(i,r.state),o);!c.eol();){if(c.pos>e.options.maxHighlightLength?(l=!1,s&&h(e,t,r,c.pos),c.pos=t.length,d=null):d=B(m(i,c,r.state,g),o),g){var v=g[0].name;v&&(d="m-"+(d?v+" "+d:v))}if(!l||u!=d){for(;a<c.start;)a=Math.min(c.start,a+5e3),n(a,u);u=d}c.start=c.pos}for(;a<c.pos;){var y=Math.min(c.pos,a+5e3);n(y,u),a=y}}function je(e,t,i){for(var r,n,o=e.doc,s=i?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>s;--l){if(l<=o.first)return o.first;var a=A(o,l-1),u=a.stateAfter;if(u&&(!i||l+(u instanceof He?u.lookAhead:0)<=o.modeFrontier))return l;var c=ke(a.text,null,e.options.tabSize);(n==null||r>c)&&(n=l-1,r=c)}return n}function Ie(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var i=e.first,r=t-1;r>i;r--){var n=A(e,r).stateAfter;if(n&&(!(n instanceof He)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}}var Ze=!1,Bt=!1;function cl(){Ze=!0}function dl(){Bt=!0}function Ji(e,t,i){this.marker=e,this.from=t,this.to=i}function gi(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function pl(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function vl(e,t,i){var r=i&&window.WeakSet&&(i.markedSpans||(i.markedSpans=new WeakSet));r&&e.markedSpans&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function gl(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var o=e[n],s=o.marker,l=o.from==null||(s.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&s.type=="bookmark"&&(!i||!o.marker.insertLeft)){var a=o.to==null||(s.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Ji(s,o.from,a?null:o.to))}}return r}function ml(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var o=e[n],s=o.marker,l=o.to==null||(s.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&s.type=="bookmark"&&(!i||o.marker.insertLeft)){var a=o.from==null||(s.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Ji(s,a?null:o.from-t,o.to==null?null:o.to-t))}}return r}function On(e,t){if(t.full)return null;var i=rr(e,t.from.line)&&A(e,t.from.line).markedSpans,r=rr(e,t.to.line)&&A(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,o=t.to.ch,s=F(t.from,t.to)==0,l=gl(i,n,s),a=ml(r,o,s),u=t.text.length==1,c=U(t.text).length+(u?n:0);if(l)for(var d=0;d<l.length;++d){var g=l[d];if(g.to==null){var v=gi(a,g.marker);v?u&&(g.to=v.to==null?null:v.to+c):g.to=n}}if(a)for(var y=0;y<a.length;++y){var x=a[y];if(x.to!=null&&(x.to+=c),x.from==null){var w=gi(l,x.marker);w||(x.from=c,u&&(l||(l=[])).push(x))}else x.from+=c,u&&(l||(l=[])).push(x)}l&&(l=Co(l)),a&&a!=l&&(a=Co(a));var T=[l];if(!u){var D=t.text.length-2,L;if(D>0&&l)for(var N=0;N<l.length;++N)l[N].to==null&&(L||(L=[])).push(new Ji(l[N].marker,null,null));for(var W=0;W<D;++W)T.push(L);T.push(a)}return T}function Co(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function yl(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(v){if(v.markedSpans)for(var y=0;y<v.markedSpans.length;++y){var x=v.markedSpans[y].marker;x.readOnly&&(!r||he(r,x)==-1)&&(r||(r=[])).push(x)}}),!r)return null;for(var n=[{from:t,to:i}],o=0;o<r.length;++o)for(var s=r[o],l=s.find(0),a=0;a<n.length;++a){var u=n[a];if(!(F(u.to,l.from)<0||F(u.from,l.to)>0)){var c=[a,1],d=F(u.from,l.from),g=F(u.to,l.to);(d<0||!s.inclusiveLeft&&!d)&&c.push({from:u.from,to:l.from}),(g>0||!s.inclusiveRight&&!g)&&c.push({from:l.to,to:u.to}),n.splice.apply(n,c),a+=c.length-3}}return n}function To(e){var t=e.markedSpans;if(t){for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}}function Lo(e,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}}function Vi(e){return e.inclusiveLeft?-1:0}function $i(e){return e.inclusiveRight?1:0}function En(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),o=F(r.from,n.from)||Vi(e)-Vi(t);if(o)return-o;var s=F(r.to,n.to)||$i(e)-$i(t);return s||t.id-e.id}function ko(e,t){var i=Bt&&e.markedSpans,r;if(i)for(var n=void 0,o=0;o<i.length;++o)n=i[o],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||En(r,n.marker)<0)&&(r=n.marker);return r}function Mo(e){return ko(e,!0)}function en(e){return ko(e,!1)}function xl(e,t){var i=Bt&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var o=i[n];o.marker.collapsed&&(o.from==null||o.from<t)&&(o.to==null||o.to>t)&&(!r||En(r,o.marker)<0)&&(r=o.marker)}return r}function Do(e,t,i,r,n){var o=A(e,t),s=Bt&&o.markedSpans;if(s)for(var l=0;l<s.length;++l){var a=s[l];if(a.marker.collapsed){var u=a.marker.find(0),c=F(u.from,i)||Vi(a.marker)-Vi(n),d=F(u.to,r)||$i(a.marker)-$i(n);if(!(c>=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(a.marker.inclusiveRight&&n.inclusiveLeft?F(u.to,i)>=0:F(u.to,i)>0)||c>=0&&(a.marker.inclusiveRight&&n.inclusiveLeft?F(u.from,r)<=0:F(u.from,r)<0)))return!0}}}function lt(e){for(var t;t=Mo(e);)e=t.find(-1,!0).line;return e}function bl(e){for(var t;t=en(e);)e=t.find(1,!0).line;return e}function Sl(e){for(var t,i;t=en(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Pn(e,t){var i=A(e,t),r=lt(i);return i==r?t:X(r)}function No(e,t){if(t>e.lastLine())return t;var i=A(e,t),r;if(!or(e,i))return t;for(;r=en(i);)i=r.find(1,!0).line;return X(i)+1}function or(e,t){var i=Bt&&t.markedSpans;if(i){for(var r=void 0,n=0;n<i.length;++n)if(r=i[n],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&Wn(e,t,r))return!0}}}function Wn(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return Wn(e,r.line,gi(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,o=0;o<t.markedSpans.length;++o)if(n=t.markedSpans[o],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&Wn(e,t,n))return!0}function Gt(e){e=lt(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var o=i.parent;o;i=o,o=i.parent)for(var s=0;s<o.children.length;++s){var l=o.children[s];if(l==i)break;t+=l.height}return t}function tn(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=Mo(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=en(r);){var o=i.find(0,!0);t-=r.text.length-o.from.ch,r=o.to.line,t+=r.text.length-o.to.ch}return t}function Hn(e){var t=e.display,i=e.doc;t.maxLine=A(i,i.first),t.maxLineLength=tn(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=tn(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var zr=function(e,t,i){this.text=e,Lo(this,t),this.height=i?i(this):1};zr.prototype.lineNo=function(){return X(this)},Vt(zr);function wl(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),To(e),Lo(e,i);var n=r?r(e):1;n!=e.height&&Ke(e,n)}function Cl(e){e.parent=null,To(e)}var Tl={},Ll={};function Ao(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ll:Tl;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Oo(e,t){var i=Mt("span",null,null,q?"padding-right: .1px":null),r={pre:Mt("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var o=n?t.rest[n-1]:t.line,s=void 0;r.pos=0,r.addToken=Ml,yr(e.display.measure)&&(s=Ye(o,e.doc.direction))&&(r.addToken=Nl(r.addToken,s)),r.map=[];var l=t!=e.display.externalMeasured&&X(o);Al(o,r,Qi(e,o,l)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=oi(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=oi(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(mr(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(q){var a=r.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return $(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=oi(r.pre.className,r.textClass||"")),r}function kl(e){var t=E("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ml(e,t,i,r,n,o,s){if(t){var l=e.splitSpaces?Dl(t,e.trailingSpace):t,a=e.cm.state.specialChars,u=!1,c;if(!a.test(t))e.col+=t.length,c=document.createTextNode(l),e.map.push(e.pos,e.pos+t.length,c),M&&z<9&&(u=!0),e.pos+=t.length;else{c=document.createDocumentFragment();for(var d=0;;){a.lastIndex=d;var g=a.exec(t),v=g?g.index-d:t.length-d;if(v){var y=document.createTextNode(l.slice(d,d+v));M&&z<9?c.appendChild(E("span",[y])):c.appendChild(y),e.map.push(e.pos,e.pos+v,y),e.col+=v,e.pos+=v}if(!g)break;d+=v+1;var x=void 0;if(g[0]==" "){var w=e.cm.options.tabSize,T=w-e.col%w;x=c.appendChild(E("span",Zt(T),"cm-tab")),x.setAttribute("role","presentation"),x.setAttribute("cm-text"," "),e.col+=T}else g[0]=="\r"||g[0]==`
11
- `?(x=c.appendChild(E("span",g[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),x.setAttribute("cm-text",g[0]),e.col+=1):(x=e.cm.options.specialCharPlaceholder(g[0]),x.setAttribute("cm-text",g[0]),M&&z<9?c.appendChild(E("span",[x])):c.appendChild(x),e.col+=1);e.map.push(e.pos,e.pos+1,x),e.pos++}}if(e.trailingSpace=l.charCodeAt(t.length-1)==32,i||r||n||u||o||s){var D=i||"";r&&(D+=r),n&&(D+=n);var L=E("span",[c],D,o);if(s)for(var N in s)s.hasOwnProperty(N)&&N!="style"&&N!="class"&&L.setAttribute(N,s[N]);return e.content.appendChild(L)}e.content.appendChild(c)}}function Dl(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var o=e.charAt(n);o==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(o="\xA0"),r+=o,i=o==" "}return r}function Nl(e,t){return function(i,r,n,o,s,l,a){n=n?n+" cm-force-border":"cm-force-border";for(var u=i.pos,c=u+r.length;;){for(var d=void 0,g=0;g<t.length&&(d=t[g],!(d.to>u&&d.from<=u));g++);if(d.to>=c)return e(i,r,n,o,s,l,a);e(i,r.slice(0,d.to-u),n,o,null,l,a),o=null,r=r.slice(d.to-u),u=d.to}}}function Eo(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function Al(e,t,i){var r=e.markedSpans,n=e.text,o=0;if(!r){for(var s=1;s<i.length;s+=2)t.addToken(t,n.slice(o,o=i[s]),Ao(i[s+1],t.cm.options));return}for(var l=n.length,a=0,u=1,c="",d,g,v=0,y,x,w,T,D;;){if(v==a){y=x=w=g="",D=null,T=null,v=1/0;for(var L=[],N=void 0,W=0;W<r.length;++W){var O=r[W],_=O.marker;if(_.type=="bookmark"&&O.from==a&&_.widgetNode)L.push(_);else if(O.from<=a&&(O.to==null||O.to>a||_.collapsed&&O.to==a&&O.from==a)){if(O.to!=null&&O.to!=a&&v>O.to&&(v=O.to,x=""),_.className&&(y+=" "+_.className),_.css&&(g=(g?g+";":"")+_.css),_.startStyle&&O.from==a&&(w+=" "+_.startStyle),_.endStyle&&O.to==v&&(N||(N=[])).push(_.endStyle,O.to),_.title&&((D||(D={})).title=_.title),_.attributes)for(var Z in _.attributes)(D||(D={}))[Z]=_.attributes[Z];_.collapsed&&(!T||En(T.marker,_)<0)&&(T=O)}else O.from>a&&v>O.from&&(v=O.from)}if(N)for(var me=0;me<N.length;me+=2)N[me+1]==v&&(x+=" "+N[me]);if(!T||T.from==a)for(var ee=0;ee<L.length;++ee)Eo(t,0,L[ee]);if(T&&(T.from||0)==a){if(Eo(t,(T.to==null?l+1:T.to)-a,T.marker,T.from==null),T.to==null)return;T.to==a&&(T=!1)}}if(a>=l)break;for(var Xe=Math.min(l,v);;){if(c){var ze=a+c.length;if(!T){var ue=ze>Xe?c.slice(0,Xe-a):c;t.addToken(t,ue,d?d+y:y,w,a+ue.length==v?x:"",g,D)}if(ze>=Xe){c=c.slice(Xe-a),a=Xe;break}a=ze,w=""}c=n.slice(o,o=i[u++]),d=Ao(i[u++],t.cm.options)}}}function Po(e,t,i){this.line=t,this.rest=Sl(t),this.size=this.rest?X(U(this.rest))-i+1:1,this.node=this.text=null,this.hidden=or(e,t)}function rn(e,t,i){for(var r=[],n,o=t;o<i;o=n){var s=new Po(e.doc,A(e.doc,o),o);n=o+s.size,r.push(s)}return r}var Br=null;function Ol(e){Br?Br.ops.push(e):e.ownsGroup=Br={ops:[e],delayedCallbacks:[]}}function El(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Pl(e,t){var i=e.ownsGroup;if(i)try{El(i)}finally{Br=null,t(i)}}var mi=null;function pe(e,t){var i=hi(e,t);if(i.length){var r=Array.prototype.slice.call(arguments,2),n;Br?n=Br.delayedCallbacks:mi?n=mi:(n=mi=[],setTimeout(Wl,0));for(var o=function(l){n.push(function(){return i[l].apply(null,r)})},s=0;s<i.length;++s)o(s)}}function Wl(){var e=mi;mi=null;for(var t=0;t<e.length;++t)e[t]()}function Wo(e,t,i,r){for(var n=0;n<t.changes.length;n++){var o=t.changes[n];o=="text"?Il(e,t):o=="gutter"?Io(e,t,i,r):o=="class"?In(e,t):o=="widget"&&Fl(e,t,r)}t.changes=null}function yi(e){return e.node==e.text&&(e.node=E("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),M&&z<8&&(e.node.style.zIndex=2)),e.node}function Hl(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=yi(t);t.background=r.insertBefore(E("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Ho(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):Oo(e,t)}function Il(e,t){var i=t.text.className,r=Ho(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,In(e,t)):i&&(t.text.className=i)}function In(e,t){Hl(e,t),t.line.wrapClass?yi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Io(e,t,i,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=yi(t);t.gutterBackground=E("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var s=yi(t),l=t.gutter=E("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(l.setAttribute("aria-hidden","true"),e.display.input.setUneditable(l),s.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!o||!o["CodeMirror-linenumbers"])&&(t.lineNumber=l.appendChild(E("div",xr(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var a=0;a<e.display.gutterSpecs.length;++a){var u=e.display.gutterSpecs[a].className,c=o.hasOwnProperty(u)&&o[u];c&&l.appendChild(E("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function Fl(e,t,i){t.alignable&&(t.alignable=null);for(var r=Yt("CodeMirror-linewidget"),n=t.node.firstChild,o=void 0;n;n=o)o=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);Fo(e,t,i)}function Rl(e,t,i,r){var n=Ho(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),In(e,t),Io(e,t,i,r),Fo(e,t,r),t.node}function Fo(e,t,i){if(Ro(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)Ro(e,t.rest[r],t,i,!1)}function Ro(e,t,i,r,n){if(t.widgets)for(var o=yi(i),s=0,l=t.widgets;s<l.length;++s){var a=l[s],u=E("div",[a.node],"CodeMirror-linewidget"+(a.className?" "+a.className:""));a.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),zl(a,u,i,r),e.display.input.setUneditable(u),n&&a.above?o.insertBefore(u,i.gutter||i.text):o.appendChild(u),pe(a,"redraw")}}function zl(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function xi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!it(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),Ee(t.display.measure,E("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Ut(e,t){for(var i=ot(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function nn(e){return e.lineSpace.offsetTop}function Fn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function zo(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ee(e.measure,E("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function St(e){return _i-e.display.nativeBarWidth}function br(e){return e.display.scroller.clientWidth-St(e)-e.display.barWidth}function Rn(e){return e.display.scroller.clientHeight-St(e)-e.display.barHeight}function Bl(e,t,i){var r=e.options.lineWrapping,n=r&&br(e);if(!t.measure.heights||r&&t.measure.width!=n){var o=t.measure.heights=[];if(r){t.measure.width=n;for(var s=t.text.firstChild.getClientRects(),l=0;l<s.length-1;l++){var a=s[l],u=s[l+1];Math.abs(a.bottom-u.bottom)>2&&o.push((a.bottom+u.top)/2-i.top)}}o.push(i.bottom-i.top)}}function Bo(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var n=0;n<e.rest.length;n++)if(X(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Gl(e,t){t=lt(t);var i=X(t),r=e.display.externalMeasured=new Po(e.doc,t,i);r.lineN=i;var n=r.built=Oo(e,r);return r.text=n.pre,Ee(e.display.lineMeasure,n.pre),r}function Go(e,t,i,r){return wt(e,Gr(e,t),i,r)}function zn(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Cr(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Gr(e,t){var i=X(t),r=zn(e,i);r&&!r.text?r=null:r&&r.changes&&(Wo(e,r,i,qn(e)),e.curOp.forceUpdate=!0),r||(r=Gl(e,t));var n=Bo(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function wt(e,t,i,r,n){t.before&&(i=-1);var o=i+(r||""),s;return t.cache.hasOwnProperty(o)?s=t.cache[o]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bl(e,t.view,t.rect),t.hasHeights=!0),s=_l(e,t,i,r),s.bogus||(t.cache[o]=s)),{left:s.left,right:s.right,top:n?s.rtop:s.top,bottom:n?s.rbottom:s.bottom}}var Uo={left:0,right:0,top:0,bottom:0};function _o(e,t,i){for(var r,n,o,s,l,a,u=0;u<e.length;u+=3)if(l=e[u],a=e[u+1],t<l?(n=0,o=1,s="left"):t<a?(n=t-l,o=n+1):(u==e.length-3||t==a&&e[u+3]>t)&&(o=a-l,n=o-1,t>=a&&(s="right")),n!=null){if(r=e[u+2],l==a&&i==(r.insertLeft?"left":"right")&&(s=i),i=="left"&&n==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],s="left";if(i=="right"&&n==a-l)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],s="right";break}return{node:r,start:n,end:o,collapse:s,coverStart:l,coverEnd:a}}function Ul(e,t){var i=Uo;if(t=="left")for(var r=0;r<e.length&&(i=e[r]).left==i.right;r++);else for(var n=e.length-1;n>=0&&(i=e[n]).left==i.right;n--);return i}function _l(e,t,i,r){var n=_o(t.map,i,r),o=n.node,s=n.start,l=n.end,a=n.collapse,u;if(o.nodeType==3){for(var c=0;c<4;c++){for(;s&&ui(t.line.text.charAt(n.coverStart+s));)--s;for(;n.coverStart+l<n.coverEnd&&ui(t.line.text.charAt(n.coverStart+l));)++l;if(M&&z<9&&s==0&&l==n.coverEnd-n.coverStart?u=o.parentNode.getBoundingClientRect():u=Ul(vt(o,s,l).getClientRects(),r),u.left||u.right||s==0)break;l=s,s=s-1,a="right"}M&&z<11&&(u=ql(e.display.measure,u))}else{s>0&&(a=r="right");var d;e.options.lineWrapping&&(d=o.getClientRects()).length>1?u=d[r=="right"?d.length-1:0]:u=o.getBoundingClientRect()}if(M&&z<9&&!s&&(!u||!u.left&&!u.right)){var g=o.parentNode.getClientRects()[0];g?u={left:g.left,right:g.left+_r(e.display),top:g.top,bottom:g.bottom}:u=Uo}for(var v=u.top-t.rect.top,y=u.bottom-t.rect.top,x=(v+y)/2,w=t.view.measure.heights,T=0;T<w.length-1&&!(x<w[T]);T++);var D=T?w[T-1]:0,L=w[T],N={left:(a=="right"?u.right:u.left)-t.rect.left,right:(a=="left"?u.left:u.right)-t.rect.left,top:D,bottom:L};return!u.left&&!u.right&&(N.bogus=!0),e.options.singleCursorHeightPerLine||(N.rtop=v,N.rbottom=y),N}function ql(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Ki(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function qo(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Xo(e){e.display.externalMeasure=null,pt(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)qo(e.display.view[t])}function bi(e){Xo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Yo(e){return se&&rt?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function Ko(e){return se&&rt?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Bn(e){var t=lt(e),i=t.widgets,r=0;if(i)for(var n=0;n<i.length;++n)i[n].above&&(r+=xi(i[n]));return r}function on(e,t,i,r,n){if(!n){var o=Bn(t);i.top+=o,i.bottom+=o}if(r=="line")return i;r||(r="local");var s=Gt(t);if(r=="local"?s+=nn(e.display):s-=e.display.viewOffset,r=="page"||r=="window"){var l=e.display.lineSpace.getBoundingClientRect();s+=l.top+(r=="window"?0:Ko(gt(e)));var a=l.left+(r=="window"?0:Yo(gt(e)));i.left+=a,i.right+=a}return i.top+=s,i.bottom+=s,i}function jo(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=Yo(gt(e)),n-=Ko(gt(e));else if(i=="local"||!i){var o=e.display.sizer.getBoundingClientRect();r+=o.left,n+=o.top}var s=e.display.lineSpace.getBoundingClientRect();return{left:r-s.left,top:n-s.top}}function sn(e,t,i,r,n){return r||(r=A(e.doc,t.line)),on(e,r,Go(e,r,t.ch,n),i)}function at(e,t,i,r,n,o){r=r||A(e.doc,t.line),n||(n=Gr(e,r));function s(y,x){var w=wt(e,n,y,x?"right":"left",o);return x?w.left=w.right:w.right=w.left,on(e,r,w,i)}var l=Ye(r,e.doc.direction),a=t.ch,u=t.sticky;if(a>=r.text.length?(a=r.text.length,u="before"):a<=0&&(a=0,u="after"),!l)return s(u=="before"?a-1:a,u=="before");function c(y,x,w){var T=l[x],D=T.level==1;return s(w?y-1:y,D!=w)}var d=$e(l,a,u),g=gr,v=c(a,d,u=="before");return g!=null&&(v.other=c(a,g,u!="before")),v}function Zo(e,t){var i=0;t=H(e.doc,t),e.options.lineWrapping||(i=_r(e.display)*t.ch);var r=A(e.doc,t.line),n=Gt(r)+nn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Gn(e,t,i,r,n){var o=b(e,t,i);return o.xRel=n,r&&(o.outside=r),o}function Un(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Gn(r.first,0,null,-1,-1);var n=bt(r,i),o=r.first+r.size-1;if(n>o)return Gn(r.first+r.size-1,A(r,o).text.length,null,1,1);t<0&&(t=0);for(var s=A(r,n);;){var l=Xl(e,s,n,t,i),a=xl(s,l.ch+(l.xRel>0||l.outside>0?1:0));if(!a)return l;var u=a.find(1);if(u.line==n)return u;s=A(r,n=u.line)}}function Qo(e,t,i,r){r-=Bn(t);var n=t.text.length,o=Jt(function(s){return wt(e,i,s-1).bottom<=r},n,0);return n=Jt(function(s){return wt(e,i,s).top>r},o,n),{begin:o,end:n}}function Jo(e,t,i,r){i||(i=Gr(e,t));var n=on(e,t,wt(e,i,r),"line").top;return Qo(e,t,i,n)}function _n(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Xl(e,t,i,r,n){n-=Gt(t);var o=Gr(e,t),s=Bn(t),l=0,a=t.text.length,u=!0,c=Ye(t,e.doc.direction);if(c){var d=(e.options.lineWrapping?Kl:Yl)(e,t,i,o,c,r,n);u=d.level!=1,l=u?d.from:d.to-1,a=u?d.to:d.from-1}var g=null,v=null,y=Jt(function(W){var O=wt(e,o,W);return O.top+=s,O.bottom+=s,_n(O,r,n,!1)?(O.top<=n&&O.left<=r&&(g=W,v=O),!0):!1},l,a),x,w,T=!1;if(v){var D=r-v.left<v.right-r,L=D==u;y=g+(L?0:1),w=L?"after":"before",x=D?v.left:v.right}else{!u&&(y==a||y==l)&&y++,w=y==0?"after":y==t.text.length?"before":wt(e,o,y-(u?1:0)).bottom+s<=n==u?"after":"before";var N=at(e,b(i,y,w),"line",t,o);x=N.left,T=n<N.top?-1:n>=N.bottom?1:0}return y=Ve(t.text,y,1),Gn(i,y,w,T,r-x)}function Yl(e,t,i,r,n,o,s){var l=Jt(function(d){var g=n[d],v=g.level!=1;return _n(at(e,b(i,v?g.to:g.from,v?"before":"after"),"line",t,r),o,s,!0)},0,n.length-1),a=n[l];if(l>0){var u=a.level!=1,c=at(e,b(i,u?a.from:a.to,u?"after":"before"),"line",t,r);_n(c,o,s,!0)&&c.top>s&&(a=n[l-1])}return a}function Kl(e,t,i,r,n,o,s){var l=Qo(e,t,r,s),a=l.begin,u=l.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,d=null,g=0;g<n.length;g++){var v=n[g];if(!(v.from>=u||v.to<=a)){var y=v.level!=1,x=wt(e,r,y?Math.min(u,v.to)-1:Math.max(a,v.from)).right,w=x<o?o-x+1e9:x-o;(!c||d>w)&&(c=v,d=w)}}return c||(c=n[n.length-1]),c.from<a&&(c={from:a,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}var Sr;function Ur(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Sr==null){Sr=E("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Sr.appendChild(document.createTextNode("x")),Sr.appendChild(E("br"));Sr.appendChild(document.createTextNode("x"))}Ee(e.measure,Sr);var i=Sr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),pt(e.measure),i||1}function _r(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=E("span","xxxxxxxxxx"),i=E("pre",[t],"CodeMirror-line-like");Ee(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function qn(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,o=t.gutters.firstChild,s=0;o;o=o.nextSibling,++s){var l=e.display.gutterSpecs[s].className;i[l]=o.offsetLeft+o.clientLeft+n,r[l]=o.clientWidth}return{fixedPos:Xn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Xn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Vo(e){var t=Ur(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/_r(e.display)-3);return function(n){if(or(e.doc,n))return 0;var o=0;if(n.widgets)for(var s=0;s<n.widgets.length;s++)n.widgets[s].height&&(o+=n.widgets[s].height);return i?o+(Math.ceil(n.text.length/r)||1)*t:o+t}}function Yn(e){var t=e.doc,i=Vo(e);t.iter(function(r){var n=i(r);n!=r.height&&Ke(r,n)})}function wr(e,t,i,r){var n=e.display;if(!i&&ot(t).getAttribute("cm-not-content")=="true")return null;var o,s,l=n.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,s=t.clientY-l.top}catch{return null}var a=Un(e,o,s),u;if(r&&a.xRel>0&&(u=A(e.doc,a.line).text).length==a.ch){var c=ke(u,u.length,e.options.tabSize)-u.length;a=b(a.line,Math.max(0,Math.round((o-zo(e.display).left)/_r(e.display))-c))}return a}function Cr(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Fe(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Bt&&Pn(e.doc,t)<n.viewTo&&lr(e);else if(i<=n.viewFrom)Bt&&No(e.doc,i+r)>n.viewFrom?lr(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)lr(e);else if(t<=n.viewFrom){var o=ln(e,i,i+r,1);o?(n.view=n.view.slice(o.index),n.viewFrom=o.lineN,n.viewTo+=r):lr(e)}else if(i>=n.viewTo){var s=ln(e,t,t,-1);s?(n.view=n.view.slice(0,s.index),n.viewTo=s.lineN):lr(e)}else{var l=ln(e,t,t,-1),a=ln(e,i,i+r,1);l&&a?(n.view=n.view.slice(0,l.index).concat(rn(e,l.lineN,a.lineN)).concat(n.view.slice(a.index)),n.viewTo+=r):lr(e)}var u=n.externalMeasured;u&&(i<u.lineN?u.lineN+=r:t<u.lineN+u.size&&(n.externalMeasured=null))}function sr(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[Cr(e,t)];if(o.node!=null){var s=o.changes||(o.changes=[]);he(s,i)==-1&&s.push(i)}}}function lr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ln(e,t,i,r){var n=Cr(e,t),o,s=e.display.view;if(!Bt||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var l=e.display.viewFrom,a=0;a<n;a++)l+=s[a].size;if(l!=t){if(r>0){if(n==s.length-1)return null;o=l+s[n].size-t,n++}else o=l-t;t+=o,i+=o}for(;Pn(e.doc,i)!=i;){if(n==(r<0?0:s.length-1))return null;i+=r*s[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function jl(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=rn(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=rn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Cr(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(rn(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Cr(e,i)))),r.viewTo=i}function $o(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function Si(e){e.display.input.showSelection(e.display.input.prepareSelection())}function es(e,t){t===void 0&&(t=!0);var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),s=e.options.$customCursor;s&&(t=!0);for(var l=0;l<i.sel.ranges.length;l++)if(!(!t&&l==i.sel.primIndex)){var a=i.sel.ranges[l];if(!(a.from().line>=e.display.viewTo||a.to().line<e.display.viewFrom)){var u=a.empty();if(s){var c=s(e,a);c&&Kn(e,c,n)}else(u||e.options.showCursorWhenSelecting)&&Kn(e,a.head,n);u||Zl(e,a,o)}}return r}function Kn(e,t,i){var r=at(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(E("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var o=sn(e,t,"div",null,null),s=o.right-o.left;n.style.width=(s>0?s:e.defaultCharWidth())+"px"}if(r.other){var l=i.appendChild(E("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=r.other.left+"px",l.style.top=r.other.top+"px",l.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function an(e,t){return e.top-t.top||e.left-t.left}function Zl(e,t,i){var r=e.display,n=e.doc,o=document.createDocumentFragment(),s=zo(e.display),l=s.left,a=Math.max(r.sizerWidth,br(e)-r.sizer.offsetLeft)-s.right,u=n.direction=="ltr";function c(L,N,W,O){N<0&&(N=0),N=Math.round(N),O=Math.round(O),o.appendChild(E("div",null,"CodeMirror-selected","position: absolute; left: "+L+`px;
12
- top: `+N+"px; width: "+(W??a-L)+`px;
13
- height: `+(O-N)+"px"))}function d(L,N,W){var O=A(n,L),_=O.text.length,Z,me;function ee(ue,Be){return sn(e,b(L,ue),"div",O,Be)}function Xe(ue,Be,be){var ce=Jo(e,O,null,ue),fe=Be=="ltr"==(be=="after")?"left":"right",ie=be=="after"?ce.begin:ce.end-(/\s/.test(O.text.charAt(ce.end-1))?2:1);return ee(ie,fe)[fe]}var ze=Ye(O,n.direction);return Dn(ze,N||0,W??_,function(ue,Be,be,ce){var fe=be=="ltr",ie=ee(ue,fe?"left":"right"),Ge=ee(Be-1,fe?"right":"left"),ri=N==null&&ue==0,dr=W==null&&Be==_,Le=ce==0,Ct=!ze||ce==ze.length-1;if(Ge.top-ie.top<=3){var ye=(u?ri:dr)&&Le,So=(u?dr:ri)&&Ct,Xt=ye?l:(fe?ie:Ge).left,Dr=So?a:(fe?Ge:ie).right;c(Xt,ie.top,Dr-Xt,ie.bottom)}else{var Nr,Ne,ii,wo;fe?(Nr=u&&ri&&Le?l:ie.left,Ne=u?a:Xe(ue,be,"before"),ii=u?l:Xe(Be,be,"after"),wo=u&&dr&&Ct?a:Ge.right):(Nr=u?Xe(ue,be,"before"):l,Ne=!u&&ri&&Le?a:ie.right,ii=!u&&dr&&Ct?l:Ge.left,wo=u?Xe(Be,be,"after"):a),c(Nr,ie.top,Ne-Nr,ie.bottom),ie.bottom<Ge.top&&c(l,ie.bottom,null,Ge.top),c(ii,Ge.top,wo-ii,Ge.bottom)}(!Z||an(ie,Z)<0)&&(Z=ie),an(Ge,Z)<0&&(Z=Ge),(!me||an(ie,me)<0)&&(me=ie),an(Ge,me)<0&&(me=Ge)}),{start:Z,end:me}}var g=t.from(),v=t.to();if(g.line==v.line)d(g.line,g.ch,v.ch);else{var y=A(n,g.line),x=A(n,v.line),w=lt(y)==lt(x),T=d(g.line,g.ch,w?y.text.length+1:null).end,D=d(v.line,w?0:null,v.ch).start;w&&(T.top<D.top-2?(c(T.right,T.top,null,T.bottom),c(l,D.top,D.left,D.bottom)):c(T.right,T.top,D.left-T.right,T.bottom)),T.bottom<D.top&&c(l,T.bottom,null,D.top)}i.appendChild(o)}function jn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||qr(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ts(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Qn(e))}function Zn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&qr(e))},100)}function Qn(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||($(e,"focus",e,t),e.state.focused=!0,nt(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),q&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),jn(e))}function qr(e,t){e.state.delayingBlurEvent||(e.state.focused&&($(e,"blur",e,t),e.state.focused=!1,kt(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function un(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,o=0,s=0;s<t.view.length;s++){var l=t.view[s],a=e.options.lineWrapping,u=void 0,c=0;if(!l.hidden){if(n+=l.line.height,M&&z<8){var d=l.node.offsetTop+l.node.offsetHeight;u=d-i,i=d}else{var g=l.node.getBoundingClientRect();u=g.bottom-g.top,!a&&l.text.firstChild&&(c=l.text.firstChild.getBoundingClientRect().right-g.left-1)}var v=l.line.height-u;if((v>.005||v<-.005)&&(n<r&&(o-=v),Ke(l.line,u),rs(l.line),l.rest))for(var y=0;y<l.rest.length;y++)rs(l.rest[y]);if(c>e.display.sizerWidth){var x=Math.ceil(c/_r(e.display));x>e.display.maxLineLength&&(e.display.maxLineLength=x,e.display.maxLine=l.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function rs(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function fn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-nn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,o=bt(t,r),s=bt(t,n);if(i&&i.ensure){var l=i.ensure.from.line,a=i.ensure.to.line;l<o?(o=l,s=bt(t,Gt(A(t,l))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=s&&(o=bt(t,Gt(A(t,a))-e.wrapper.clientHeight),s=a)}return{from:o,to:Math.max(s,o+1)}}function Ql(e,t){if(!le(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,o=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(n=!1),n!=null&&!Lt){var s=E("div","\u200B",null,`position: absolute;
14
- top: `+(t.top-i.viewOffset-nn(e.display))+`px;
15
- height: `+(t.bottom-t.top+St(e)+i.barHeight)+`px;
16
- left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(n),e.display.lineSpace.removeChild(s)}}}function Jl(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?b(t.line,t.ch+1,"before"):t,t=t.ch?b(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var s=!1,l=at(e,t),a=!i||i==t?l:at(e,i);n={left:Math.min(l.left,a.left),top:Math.min(l.top,a.top)-r,right:Math.max(l.left,a.left),bottom:Math.max(l.bottom,a.bottom)+r};var u=Jn(e,n),c=e.doc.scrollTop,d=e.doc.scrollLeft;if(u.scrollTop!=null&&(Ci(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(s=!0)),u.scrollLeft!=null&&(Tr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(s=!0)),!s)break}return n}function Vl(e,t){var i=Jn(e,t);i.scrollTop!=null&&Ci(e,i.scrollTop),i.scrollLeft!=null&&Tr(e,i.scrollLeft)}function Jn(e,t){var i=e.display,r=Ur(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,o=Rn(e),s={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Fn(i),a=t.top<r,u=t.bottom>l-r;if(t.top<n)s.scrollTop=a?0:t.top;else if(t.bottom>n+o){var c=Math.min(t.top,(u?l:t.bottom)-o);c!=n&&(s.scrollTop=c)}var d=e.options.fixedGutter?0:i.gutters.offsetWidth,g=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-d,v=br(e)-i.gutters.offsetWidth,y=t.right-t.left>v;return y&&(t.right=t.left+v),t.left<10?s.scrollLeft=0:t.left<g?s.scrollLeft=Math.max(0,t.left+d-(y?0:10)):t.right>v+g-3&&(s.scrollLeft=t.right+(y?0:10)-v),s}function Vn(e,t){t!=null&&(hn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Xr(e){hn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function wi(e,t,i){(t!=null||i!=null)&&hn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function $l(e,t){hn(e),e.curOp.scrollToPos=t}function hn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=Zo(e,t.from),r=Zo(e,t.to);is(e,i,r,t.margin)}}function is(e,t,i,r){var n=Jn(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});wi(e,n.scrollLeft,n.scrollTop)}function Ci(e,t){Math.abs(e.doc.scrollTop-t)<2||(Q||eo(e,{top:t}),ns(e,t,!0),Q&&eo(e),ki(e,100))}function ns(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Tr(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,us(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Ti(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+Fn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+St(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Lr=function(e,t,i){this.cm=i;var r=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),I(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),I(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,M&&z<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Lr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Lr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Lr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Lr.prototype.zeroWidthHack=function(){var e=Ae&&!Ui?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new xt,this.disableVert=new xt},Lr.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),o=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);o!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Lr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Li=function(){};Li.prototype.update=function(){return{bottom:0,right:0}},Li.prototype.setScrollLeft=function(){},Li.prototype.setScrollTop=function(){},Li.prototype.clear=function(){};function Yr(e,t){t||(t=Ti(e));var i=e.display.barWidth,r=e.display.barHeight;os(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&un(e),os(e,Ti(e)),i=e.display.barWidth,r=e.display.barHeight}function os(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var ss={native:Lr,null:Li};function ls(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&kt(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ss[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),I(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Tr(e,t):Ci(e,t)},e),e.display.scrollbars.addClass&&nt(e.display.wrapper,e.display.scrollbars.addClass)}var ea=0;function kr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++ea,markArrays:null},Ol(e.curOp)}function Mr(e){var t=e.curOp;t&&Pl(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;ta(i)})}function ta(e){for(var t=e.ops,i=0;i<t.length;i++)ra(t[i]);for(var r=0;r<t.length;r++)ia(t[r]);for(var n=0;n<t.length;n++)na(t[n]);for(var o=0;o<t.length;o++)oa(t[o]);for(var s=0;s<t.length;s++)sa(t[s])}function ra(e){var t=e.cm,i=t.display;aa(t),e.updateMaxLine&&Hn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new cn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function ia(e){e.updatedDisplay=e.mustUpdate&&$n(e.cm,e.update)}function na(e){var t=e.cm,i=t.display;e.updatedDisplay&&un(t),e.barMeasure=Ti(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Go(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+St(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-br(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function oa(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Tr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==we(mt(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Yr(t,e.barMeasure),e.updatedDisplay&&ro(t,e.barMeasure),e.selectionChanged&&jn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&ts(e.cm)}function sa(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&as(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&ns(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Tr(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=Jl(t,H(r,e.scrollToPos.from),H(r,e.scrollToPos.to),e.scrollToPos.margin);Ql(t,n)}var o=e.maybeHiddenMarkers,s=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||$(o[l],"hide");if(s)for(var a=0;a<s.length;++a)s[a].lines.length&&$(s[a],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&$(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function qe(e,t){if(e.curOp)return t();kr(e);try{return t()}finally{Mr(e)}}function ve(e,t){return function(){if(e.curOp)return t.apply(e,arguments);kr(e);try{return t.apply(e,arguments)}finally{Mr(e)}}}function De(e){return function(){if(this.curOp)return e.apply(this,arguments);kr(this);try{return e.apply(this,arguments)}finally{Mr(this)}}}function ge(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);kr(t);try{return e.apply(this,arguments)}finally{Mr(t)}}}function ki(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,Kt(la,e))}function la(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var i=+new Date+e.options.workTime,r=f(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var s=o.styles,l=o.text.length>e.options.maxHighlightLength?Ht(t.mode,r.state):null,a=vi(e,o,r,!0);l&&(r.state=l),o.styles=a.styles;var u=o.styleClasses,c=a.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var d=!s||s.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),g=0;!d&&g<s.length;++g)d=s[g]!=o.styles[g];d&&n.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=e.options.maxHighlightLength&&h(e,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return ki(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&qe(e,function(){for(var o=0;o<n.length;o++)sr(e,n[o],"text")})}}var cn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=fn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=br(e),this.force=i,this.dims=qn(e),this.events=[]};cn.prototype.signal=function(e,t){xe(e,t)&&this.events.push(arguments)},cn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)$.apply(null,this.events[e])};function aa(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=St(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=St(e)+"px",t.scrollbarsClipped=!0)}function ua(e){if(e.hasFocus())return null;var t=we(mt(e));if(!t||!it(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=Or(e).getSelection();r.anchorNode&&r.extend&&it(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function fa(e){if(!(!e||!e.activeElt||e.activeElt==we(yt(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&it(document.body,e.anchorNode)&&it(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,i=t.defaultView.getSelection(),r=t.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),i.removeAllRanges(),i.addRange(r),i.extend(e.focusNode,e.focusOffset)}}function $n(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return lr(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&$o(e)==0)return!1;fs(e)&&(lr(e),t.dims=qn(e));var n=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),s=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<o&&o-i.viewFrom<20&&(o=Math.max(r.first,i.viewFrom)),i.viewTo>s&&i.viewTo-s<20&&(s=Math.min(n,i.viewTo)),Bt&&(o=Pn(e.doc,o),s=No(e.doc,s));var l=o!=i.viewFrom||s!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;jl(e,o,s),i.viewOffset=Gt(A(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var a=$o(e);if(!l&&a==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var u=ua(e);return a>4&&(i.lineDiv.style.display="none"),ha(e,i.updateLineNumbers,t.dims),a>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,fa(u),pt(i.cursorDiv),pt(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,l&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,ki(e,400)),i.updateLineNumbers=null,!0}function as(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==br(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+Fn(e.display)-Rn(e),i.top)}),t.visible=fn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=fn(e.display,e.doc,i));if(!$n(e,t))break;un(e);var n=Ti(e);Si(e),Yr(e,n),ro(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function eo(e,t){var i=new cn(e,t);if($n(e,i)){un(e),as(e,i);var r=Ti(e);Si(e),Yr(e,r),ro(e,r),i.finish()}}function ha(e,t,i){var r=e.display,n=e.options.lineNumbers,o=r.lineDiv,s=o.firstChild;function l(y){var x=y.nextSibling;return q&&Ae&&e.display.currentWheelTarget==y?y.style.display="none":y.parentNode.removeChild(y),x}for(var a=r.view,u=r.viewFrom,c=0;c<a.length;c++){var d=a[c];if(!d.hidden)if(!d.node||d.node.parentNode!=o){var g=Rl(e,d,u,i);o.insertBefore(g,s)}else{for(;s!=d.node;)s=l(s);var v=n&&t!=null&&t<=u&&d.lineNumber;d.changes&&(he(d.changes,"gutter")>-1&&(v=!1),Wo(e,d,u,i)),v&&(pt(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(xr(e.options,u)))),s=d.node.nextSibling}u+=d.size}for(;s;)s=l(s)}function to(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",pe(e,"gutterChanged",e)}function ro(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+St(e)+"px"}function us(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Xn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,o=r+"px",s=0;s<i.length;s++)if(!i[s].hidden){e.options.fixedGutter&&(i[s].gutter&&(i[s].gutter.style.left=o),i[s].gutterBackground&&(i[s].gutterBackground.style.left=o));var l=i[s].alignable;if(l)for(var a=0;a<l.length;a++)l[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}}function fs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=xr(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(E("div",[E("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=n.firstChild.offsetWidth,s=n.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-s)+1,r.lineNumWidth=r.lineNumInnerWidth+s,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",to(e.display),!0}return!1}function io(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var o=e[n],s=null;if(typeof o!="string"&&(s=o.style,o=o.className),o=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:o,style:s})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function hs(e){var t=e.gutters,i=e.gutterSpecs;pt(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],o=n.className,s=n.style,l=t.appendChild(E("div",null,"CodeMirror-gutter "+o));s&&(l.style.cssText=s),o=="CodeMirror-linenumbers"&&(e.lineGutter=l,l.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",to(e)}function Mi(e){hs(e.display),Fe(e),us(e)}function ca(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=E("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=E("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=Mt("div",null,"CodeMirror-code"),n.selectionDiv=E("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=E("div",null,"CodeMirror-cursors"),n.measure=E("div",null,"CodeMirror-measure"),n.lineMeasure=E("div",null,"CodeMirror-measure"),n.lineSpace=Mt("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var o=Mt("div",[n.lineSpace],"CodeMirror-lines");n.mover=E("div",[o],null,"position: relative"),n.sizer=E("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=E("div",null,null,"position: absolute; height: "+_i+"px; width: 1px;"),n.gutters=E("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=E("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=E("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),se&&Se===105&&(n.wrapper.style.clipPath="inset(0px)"),n.wrapper.setAttribute("translate","no"),M&&z<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!q&&!(Q&&ct)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=io(r.gutters,r.lineNumbers),hs(n),i.init(n)}var dn=0,_t=null;M?_t=-.53:Q?_t=15:se?_t=-.7:Tt&&(_t=-1/3);function cs(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function da(e){var t=cs(e);return t.x*=_t,t.y*=_t,t}function ds(e,t){se&&Se==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var i=cs(t),r=i.x,n=i.y,o=_t;t.deltaMode===0&&(r=t.deltaX,n=t.deltaY,o=1);var s=e.display,l=s.scroller,a=l.scrollWidth>l.clientWidth,u=l.scrollHeight>l.clientHeight;if(r&&a||n&&u){if(n&&Ae&&q){e:for(var c=t.target,d=s.view;c!=l;c=c.parentNode)for(var g=0;g<d.length;g++)if(d[g].node==c){e.display.currentWheelTarget=c;break e}}if(r&&!Q&&!ne&&o!=null){n&&u&&Ci(e,Math.max(0,l.scrollTop+n*o)),Tr(e,Math.max(0,l.scrollLeft+r*o)),(!n||n&&u)&&de(t),s.wheelStartX=null;return}if(n&&o!=null){var v=n*o,y=e.doc.scrollTop,x=y+s.wrapper.clientHeight;v<0?y=Math.max(0,y+v-50):x=Math.min(e.doc.height,x+v+50),eo(e,{top:y,bottom:x})}dn<20&&t.deltaMode!==0&&(s.wheelStartX==null?(s.wheelStartX=l.scrollLeft,s.wheelStartY=l.scrollTop,s.wheelDX=r,s.wheelDY=n,setTimeout(function(){if(s.wheelStartX!=null){var w=l.scrollLeft-s.wheelStartX,T=l.scrollTop-s.wheelStartY,D=T&&s.wheelDY&&T/s.wheelDY||w&&s.wheelDX&&w/s.wheelDX;s.wheelStartX=s.wheelStartY=null,D&&(_t=(_t*dn+D)/(dn+1),++dn)}},200)):(s.wheelDX+=r,s.wheelDY+=n))}}var Qe=function(e,t){this.ranges=e,this.primIndex=t};Qe.prototype.primary=function(){return this.ranges[this.primIndex]},Qe.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],r=e.ranges[t];if(!Ft(i.anchor,r.anchor)||!Ft(i.head,r.head))return!1}return!0},Qe.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Y(ir(this.ranges[t].anchor),ir(this.ranges[t].head));return new Qe(e,this.primIndex)},Qe.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Qe.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(F(t,r.from())>=0&&F(e,r.to())<=0)return i}return-1};var Y=function(e,t){this.anchor=e,this.head=t};Y.prototype.from=function(){return Ce(this.anchor,this.head)},Y.prototype.to=function(){return Rt(this.anchor,this.head)},Y.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ut(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(g,v){return F(g.from(),v.from())}),i=he(t,n);for(var o=1;o<t.length;o++){var s=t[o],l=t[o-1],a=F(l.to(),s.from());if(r&&!s.empty()?a>0:a>=0){var u=Ce(l.from(),s.from()),c=Rt(l.to(),s.to()),d=l.empty()?s.from()==s.head:l.from()==l.head;o<=i&&--i,t.splice(--o,2,new Y(d?c:u,d?u:c))}}return new Qe(t,i)}function ar(e,t){return new Qe([new Y(e,t||e)],0)}function ur(e){return e.text?b(e.from.line+e.text.length-1,U(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ps(e,t){if(F(e,t.from)<0)return e;if(F(e,t.to)<=0)return ur(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=ur(t).ch-t.to.ch),b(i,r)}function no(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new Y(ps(n.anchor,t),ps(n.head,t)))}return ut(e.cm,i,e.sel.primIndex)}function vs(e,t,i){return e.line==t.line?b(i.line,e.ch-t.ch+i.ch):b(i.line+(e.line-t.line),e.ch)}function pa(e,t,i){for(var r=[],n=b(e.first,0),o=n,s=0;s<t.length;s++){var l=t[s],a=vs(l.from,n,o),u=vs(ur(l),n,o);if(n=l.to,o=u,i=="around"){var c=e.sel.ranges[s],d=F(c.head,c.anchor)<0;r[s]=new Y(d?u:a,d?a:u)}else r[s]=new Y(a,a)}return new Qe(r,e.sel.primIndex)}function oo(e){e.doc.mode=di(e.options,e.doc.modeOption),Di(e)}function Di(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ki(e,100),e.state.modeGen++,e.curOp&&Fe(e)}function gs(e,t){return t.from.ch==0&&t.to.ch==0&&U(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function so(e,t,i,r){function n(D){return i?i[D]:null}function o(D,L,N){wl(D,L,N,r),pe(D,"change",D,t)}function s(D,L){for(var N=[],W=D;W<L;++W)N.push(new zr(u[W],n(W),r));return N}var l=t.from,a=t.to,u=t.text,c=A(e,l.line),d=A(e,a.line),g=U(u),v=n(u.length-1),y=a.line-l.line;if(t.full)e.insert(0,s(0,u.length)),e.remove(u.length,e.size-u.length);else if(gs(e,t)){var x=s(0,u.length-1);o(d,d.text,v),y&&e.remove(l.line,y),x.length&&e.insert(l.line,x)}else if(c==d)if(u.length==1)o(c,c.text.slice(0,l.ch)+g+c.text.slice(a.ch),v);else{var w=s(1,u.length-1);w.push(new zr(g+c.text.slice(a.ch),v,r)),o(c,c.text.slice(0,l.ch)+u[0],n(0)),e.insert(l.line+1,w)}else if(u.length==1)o(c,c.text.slice(0,l.ch)+u[0]+d.text.slice(a.ch),n(0)),e.remove(l.line+1,y);else{o(c,c.text.slice(0,l.ch)+u[0],n(0)),o(d,g+d.text.slice(a.ch),v);var T=s(1,u.length-1);y>1&&e.remove(l.line+1,y-1),e.insert(l.line+1,T)}pe(e,"change",e,t)}function fr(e,t,i){function r(n,o,s){if(n.linked)for(var l=0;l<n.linked.length;++l){var a=n.linked[l];if(a.doc!=o){var u=s&&a.sharedHist;i&&!u||(t(a.doc,u),r(a.doc,n,u))}}}r(e,null,!0)}function ms(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Yn(e),oo(e),ys(e),e.options.direction=t.direction,e.options.lineWrapping||Hn(e),e.options.mode=t.modeOption,Fe(e)}function ys(e){(e.doc.direction=="rtl"?nt:kt)(e.display.lineDiv,"CodeMirror-rtl")}function va(e){qe(e,function(){ys(e),Fe(e)})}function pn(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function lo(e,t){var i={from:ir(t.from),to:ur(t),text:It(e,t.from,t.to)};return Ss(e,i,t.from.line,t.to.line+1),fr(e,function(r){return Ss(r,i,t.from.line,t.to.line+1)},!0),i}function xs(e){for(;e.length;){var t=U(e);if(t.ranges)e.pop();else break}}function ga(e,t){if(t)return xs(e.done),U(e.done);if(e.done.length&&!U(e.done).ranges)return U(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),U(e.done)}function bs(e,t,i,r){var n=e.history;n.undone.length=0;var o=+new Date,s,l;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(s=ga(n,n.lastOp==r)))l=U(s.changes),F(t.from,t.to)==0&&F(t.from,l.to)==0?l.to=ur(t):s.changes.push(lo(e,t));else{var a=U(n.done);for((!a||!a.ranges)&&vn(e.sel,n.done),s={changes:[lo(e,t)],generation:n.generation},n.done.push(s);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=o,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,l||$(e,"historyAdded")}function ma(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function ya(e,t,i,r){var n=e.history,o=r&&r.origin;i==n.lastSelOp||o&&n.lastSelOrigin==o&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==o||ma(e,o,U(n.done),t))?n.done[n.done.length-1]=t:vn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=o,n.lastSelOp=i,r&&r.clearRedo!==!1&&xs(n.undone)}function vn(e,t){var i=U(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Ss(e,t,i,r){var n=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(s){s.markedSpans&&((n||(n=t["spans_"+e.id]={}))[o]=s.markedSpans),++o})}function xa(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function ba(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(xa(i[n]));return r}function ws(e,t){var i=ba(e,t),r=On(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var o=i[n],s=r[n];if(o&&s)e:for(var l=0;l<s.length;++l){for(var a=s[l],u=0;u<o.length;++u)if(o[u].marker==a.marker)continue e;o.push(a)}else s&&(i[n]=s)}return i}function Kr(e,t,i){for(var r=[],n=0;n<e.length;++n){var o=e[n];if(o.ranges){r.push(i?Qe.prototype.deepCopy.call(o):o);continue}var s=o.changes,l=[];r.push({changes:l});for(var a=0;a<s.length;++a){var u=s[a],c=void 0;if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&he(t,Number(c[1]))>-1&&(U(l)[d]=u[d],delete u[d])}}return r}function ao(e,t,i,r){if(r){var n=e.anchor;if(i){var o=F(t,n)<0;o!=F(i,n)<0?(n=t,t=i):o!=F(t,i)<0&&(t=i)}return new Y(n,t)}else return new Y(i||t,t)}function gn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),Te(e,new Qe([ao(e.sel.primary(),t,i,n)],0),r)}function Cs(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=ao(e.sel.ranges[o],t[o],null,n);var s=ut(e.cm,r,e.sel.primIndex);Te(e,s,i)}function uo(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,Te(e,ut(e.cm,n,e.sel.primIndex),r)}function Ts(e,t,i,r){Te(e,ar(t,i),r)}function Sa(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var o=0;o<n.length;o++)this.ranges[o]=new Y(H(e,n[o].anchor),H(e,n[o].head))},origin:i&&i.origin};return $(e,"beforeSelectionChange",e,r),e.cm&&$(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?ut(e.cm,r.ranges,r.ranges.length-1):t}function Ls(e,t,i){var r=e.history.done,n=U(r);n&&n.ranges?(r[r.length-1]=t,mn(e,t,i)):Te(e,t,i)}function Te(e,t,i){mn(e,t,i),ya(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function mn(e,t,i){(xe(e,"beforeSelectionChange")||e.cm&&xe(e.cm,"beforeSelectionChange"))&&(t=Sa(e,t,i));var r=i&&i.bias||(F(t.primary().head,e.sel.primary().head)<0?-1:1);ks(e,Ds(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&Xr(e.cm)}function ks(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Xi(e.cm)),pe(e,"cursorActivity",e))}function Ms(e){ks(e,Ds(e,e.sel,null,!1))}function Ds(e,t,i,r){for(var n,o=0;o<t.ranges.length;o++){var s=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=yn(e,s.anchor,l&&l.anchor,i,r),u=s.head==s.anchor?a:yn(e,s.head,l&&l.head,i,r);(n||a!=s.anchor||u!=s.head)&&(n||(n=t.ranges.slice(0,o)),n[o]=new Y(a,u))}return n?ut(e.cm,n,t.primIndex):t}function jr(e,t,i,r,n){var o=A(e,t.line);if(o.markedSpans)for(var s=0;s<o.markedSpans.length;++s){var l=o.markedSpans[s],a=l.marker,u="selectLeft"in a?!a.selectLeft:a.inclusiveLeft,c="selectRight"in a?!a.selectRight:a.inclusiveRight;if((l.from==null||(u?l.from<=t.ch:l.from<t.ch))&&(l.to==null||(c?l.to>=t.ch:l.to>t.ch))){if(n&&($(a,"beforeCursorEnter"),a.explicitlyCleared))if(o.markedSpans){--s;continue}else break;if(!a.atomic)continue;if(i){var d=a.find(r<0?1:-1),g=void 0;if((r<0?c:u)&&(d=Ns(e,d,-r,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(g=F(d,i))&&(r<0?g<0:g>0))return jr(e,d,t,r,n)}var v=a.find(r<0?-1:1);return(r<0?u:c)&&(v=Ns(e,v,r,v.line==t.line?o:null)),v?jr(e,v,t,r,n):null}}return t}function yn(e,t,i,r,n){var o=r||1,s=jr(e,t,i,o,n)||!n&&jr(e,t,i,o,!0)||jr(e,t,i,-o,n)||!n&&jr(e,t,i,-o,!0);return s||(e.cantEdit=!0,b(e.first,0))}function Ns(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?H(e,b(t.line-1)):null:i>0&&t.ch==(r||A(e,t.line)).text.length?t.line<e.first+e.size-1?b(t.line+1,0):null:new b(t.line,t.ch+i)}function As(e){e.setSelection(b(e.firstLine(),0),b(e.lastLine()),Je)}function Os(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,o,s,l){n&&(r.from=H(e,n)),o&&(r.to=H(e,o)),s&&(r.text=s),l!==void 0&&(r.origin=l)}),$(e,"beforeChange",e,r),e.cm&&$(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Zr(e,t,i){if(e.cm){if(!e.cm.curOp)return ve(e.cm,Zr)(e,t,i);if(e.cm.state.suppressEdits)return}if(!((xe(e,"beforeChange")||e.cm&&xe(e.cm,"beforeChange"))&&(t=Os(e,t,!0),!t))){var r=Ze&&!i&&yl(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Es(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Es(e,t)}}function Es(e,t){if(!(t.text.length==1&&t.text[0]==""&&F(t.from,t.to)==0)){var i=no(e,t);bs(e,t,i,e.cm?e.cm.curOp.id:NaN),Ni(e,t,i,On(e,t));var r=[];fr(e,function(n,o){!o&&he(r,n.history)==-1&&(Is(n.history,t),r.push(n.history)),Ni(n,t,null,On(n,t))})}}function xn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,o,s=e.sel,l=t=="undo"?n.done:n.undone,a=t=="undo"?n.undone:n.done,u=0;u<l.length&&(o=l[u],!(i?o.ranges&&!o.equals(e.sel):!o.ranges));u++);if(u!=l.length){for(n.lastOrigin=n.lastSelOrigin=null;;)if(o=l.pop(),o.ranges){if(vn(o,a),i&&!o.equals(e.sel)){Te(e,o,{clearRedo:!1});return}s=o}else if(r){l.push(o);return}else break;var c=[];vn(s,a),a.push({changes:c,generation:n.generation}),n.generation=o.generation||++n.maxGeneration;for(var d=xe(e,"beforeChange")||e.cm&&xe(e.cm,"beforeChange"),g=function(x){var w=o.changes[x];if(w.origin=t,d&&!Os(e,w,!1))return l.length=0,{};c.push(lo(e,w));var T=x?no(e,w):U(l);Ni(e,w,T,ws(e,w)),!x&&e.cm&&e.cm.scrollIntoView({from:w.from,to:ur(w)});var D=[];fr(e,function(L,N){!N&&he(D,L.history)==-1&&(Is(L.history,w),D.push(L.history)),Ni(L,w,null,ws(L,w))})},v=o.changes.length-1;v>=0;--v){var y=g(v);if(y)return y.v}}}}function Ps(e,t){if(t!=0&&(e.first+=t,e.sel=new Qe(Nt(e.sel.ranges,function(n){return new Y(b(n.anchor.line+t,n.anchor.ch),b(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){Fe(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)sr(e.cm,r,"gutter")}}function Ni(e,t,i,r){if(e.cm&&!e.cm.curOp)return ve(e.cm,Ni)(e,t,i,r);if(t.to.line<e.first){Ps(e,t.text.length-1-(t.to.line-t.from.line));return}if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);Ps(e,n),t={from:b(e.first,0),to:b(t.to.line+n,t.to.ch),text:[U(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:b(o,A(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=It(e,t.from,t.to),i||(i=no(e,t)),e.cm?wa(e.cm,t,r):so(e,t,r),mn(e,i,Je),e.cantEdit&&yn(e,b(e.firstLine(),0))&&(e.cantEdit=!1)}}function wa(e,t,i){var r=e.doc,n=e.display,o=t.from,s=t.to,l=!1,a=o.line;e.options.lineWrapping||(a=X(lt(A(r,o.line))),r.iter(a,s.line+1,function(v){if(v==n.maxLine)return l=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Xi(e),so(r,t,i,Vo(e)),e.options.lineWrapping||(r.iter(a,o.line+t.text.length,function(v){var y=tn(v);y>n.maxLineLength&&(n.maxLine=v,n.maxLineLength=y,n.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),Ie(r,o.line),ki(e,400);var u=t.text.length-(s.line-o.line)-1;t.full?Fe(e):o.line==s.line&&t.text.length==1&&!gs(e.doc,t)?sr(e,o.line,"text"):Fe(e,o.line,s.line+1,u);var c=xe(e,"changes"),d=xe(e,"change");if(d||c){var g={from:o,to:s,text:t.text,removed:t.removed,origin:t.origin};d&&pe(e,"change",e,g),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(g)}e.display.selForContextMenu=null}function Qr(e,t,i,r,n){var o;r||(r=i),F(r,i)<0&&(o=[r,i],i=o[0],r=o[1]),typeof t=="string"&&(t=e.splitLines(t)),Zr(e,{from:i,to:r,text:t,origin:n})}function Ws(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Hs(e,t,i,r){for(var n=0;n<e.length;++n){var o=e[n],s=!0;if(o.ranges){o.copied||(o=e[n]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)Ws(o.ranges[l].anchor,t,i,r),Ws(o.ranges[l].head,t,i,r);continue}for(var a=0;a<o.changes.length;++a){var u=o.changes[a];if(i<u.from.line)u.from=b(u.from.line+r,u.from.ch),u.to=b(u.to.line+r,u.to.ch);else if(t<=u.to.line){s=!1;break}}s||(e.splice(0,n+1),n=0)}}function Is(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;Hs(e.done,i,r,n),Hs(e.undone,i,r,n)}function Ai(e,t,i,r){var n=t,o=t;return typeof t=="number"?o=A(e,zt(e,t)):n=X(t),n==null?null:(r(o,n)&&e.cm&&sr(e.cm,n,i),o)}function Oi(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Oi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,Cl(n),pe(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function Ei(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}Ei.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var o=Math.min(t,n-e),s=r.height;if(r.removeInner(e,o),this.height-=s-r.height,n==o&&(this.children.splice(i--,1),r.parent=null),(t-=o)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Oi))){var l=[];this.collapse(l),this.children=[new Oi(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],o=n.chunkSize();if(e<=o){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var s=n.lines.length%25+25,l=s;l<n.lines.length;){var a=new Oi(n.lines.slice(l,l+=25));n.height-=a.height,this.children.splice(++r,0,a),a.parent=this}n.lines=n.lines.slice(0,s),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Ei(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=he(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new Ei(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],o=n.chunkSize();if(e<o){var s=Math.min(t,o-e);if(n.iterN(e,s,i))return!0;if((t-=s)==0)break;e=0}else e-=o}}};var Pi=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Pi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=X(i);if(!(r==null||!t)){for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var o=xi(this);Ke(i,Math.max(0,i.height-o)),e&&(qe(e,function(){Fs(e,i,-o),sr(e,r,"widget")}),pe(e,"lineWidgetCleared",e,this,r))}},Pi.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=xi(this)-t;n&&(or(this.doc,r)||Ke(r,r.height+n),i&&qe(i,function(){i.curOp.forceUpdate=!0,Fs(i,r,n),pe(i,"lineWidgetChanged",i,e,X(r))}))},Vt(Pi);function Fs(e,t,i){Gt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Vn(e,i)}function Ca(e,t,i,r){var n=new Pi(e,i,r),o=e.cm;return o&&n.noHScroll&&(o.display.alignWidgets=!0),Ai(e,t,"widget",function(s){var l=s.widgets||(s.widgets=[]);if(n.insertAt==null?l.push(n):l.splice(Math.min(l.length,Math.max(0,n.insertAt)),0,n),n.line=s,o&&!or(e,s)){var a=Gt(s)<e.scrollTop;Ke(s,s.height+xi(n)),a&&Vn(o,n.height),o.curOp.forceUpdate=!0}return!0}),o&&pe(o,"lineWidgetAdded",o,n,typeof t=="number"?t:X(t)),n}var Rs=0,hr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Rs};hr.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&kr(e),xe(this,"clear")){var i=this.find();i&&pe(this,"clear",i.from,i.to)}for(var r=null,n=null,o=0;o<this.lines.length;++o){var s=this.lines[o],l=gi(s.markedSpans,this);e&&!this.collapsed?sr(e,X(s),"text"):e&&(l.to!=null&&(n=X(s)),l.from!=null&&(r=X(s))),s.markedSpans=pl(s.markedSpans,l),l.from==null&&this.collapsed&&!or(this.doc,s)&&e&&Ke(s,Ur(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var a=0;a<this.lines.length;++a){var u=lt(this.lines[a]),c=tn(u);c>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Fe(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ms(e.doc)),e&&pe(e,"markerCleared",e,this,r,n),t&&Mr(e),this.parent&&this.parent.clear()}},hr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var o=this.lines[n],s=gi(o.markedSpans,this);if(s.from!=null&&(i=b(t?o:X(o),s.from),e==-1))return i;if(s.to!=null&&(r=b(t?o:X(o),s.to),e==1))return r}return i&&{from:i,to:r}},hr.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;!t||!r||qe(r,function(){var n=t.line,o=X(t.line),s=zn(r,o);if(s&&(qo(s),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!or(i.doc,n)&&i.height!=null){var l=i.height;i.height=null;var a=xi(i)-l;a&&Ke(n,n.height+a)}pe(r,"markerChanged",r,e)})},hr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||he(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},hr.prototype.detachLine=function(e){if(this.lines.splice(he(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Vt(hr);function Jr(e,t,i,r,n){if(r&&r.shared)return Ta(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return ve(e.cm,Jr)(e,t,i,r,n);var o=new hr(e,n),s=F(t,i);if(r&&Dt(r,o,!1),s>0||s==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Mt("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Do(e,t.line,t,i,o)||t.line!=i.line&&Do(e,i.line,t,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");dl()}o.addToHistory&&bs(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var l=t.line,a=e.cm,u;if(e.iter(l,i.line+1,function(d){a&&o.collapsed&&!a.options.lineWrapping&&lt(d)==a.display.maxLine&&(u=!0),o.collapsed&&l!=t.line&&Ke(d,0),vl(d,new Ji(o,l==t.line?t.ch:null,l==i.line?i.ch:null),e.cm&&e.cm.curOp),++l}),o.collapsed&&e.iter(t.line,i.line+1,function(d){or(e,d)&&Ke(d,0)}),o.clearOnEnter&&I(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(cl(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Rs,o.atomic=!0),a){if(u&&(a.curOp.updateMaxLine=!0),o.collapsed)Fe(a,t.line,i.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=i.line;c++)sr(a,c,"text");o.atomic&&Ms(a.doc),pe(a,"markerAdded",a,o)}return o}var Wi=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Wi.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();pe(this,"clear")}},Wi.prototype.find=function(e,t){return this.primary.find(e,t)},Vt(Wi);function Ta(e,t,i,r,n){r=Dt(r),r.shared=!1;var o=[Jr(e,t,i,r,n)],s=o[0],l=r.widgetNode;return fr(e,function(a){l&&(r.widgetNode=l.cloneNode(!0)),o.push(Jr(a,H(a,t),H(a,i),r,n));for(var u=0;u<a.linked.length;++u)if(a.linked[u].isParent)return;s=U(o)}),new Wi(o,s)}function zs(e){return e.findMarks(b(e.first,0),e.clipPos(b(e.lastLine())),function(t){return t.parent})}function La(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),o=e.clipPos(n.from),s=e.clipPos(n.to);if(F(o,s)){var l=Jr(e,o,s,r.primary,r.primary.type);r.markers.push(l),l.parent=r}}}function ka(e){for(var t=function(r){var n=e[r],o=[n.primary.doc];fr(n.primary.doc,function(a){return o.push(a)});for(var s=0;s<n.markers.length;s++){var l=n.markers[s];he(o,l.doc)==-1&&(l.parent=null,n.markers.splice(s--,1))}},i=0;i<e.length;i++)t(i)}var Ma=0,Re=function(e,t,i,r,n){if(!(this instanceof Re))return new Re(e,t,i,r,n);i==null&&(i=0),Ei.call(this,[new Oi([new zr("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var o=b(i,0);this.sel=ar(o),this.history=new pn(null),this.id=++Ma,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),so(this,{from:o,to:o,text:e}),Te(this,ar(o),Je)};Re.prototype=Wr(Ei.prototype,{constructor:Re,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Rr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:ge(function(e){var t=b(this.first,0),i=this.first+this.size-1;Zr(this,{from:t,to:b(i,A(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&wi(this.cm,0,0),Te(this,ar(t),Je)}),replaceRange:function(e,t,i,r){t=H(this,t),i=i?H(this,i):t,Qr(this,e,t,i,r)},getRange:function(e,t,i){var r=It(this,H(this,e),H(this,t));return i===!1?r:i===""?r.join(""):r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(rr(this,e))return A(this,e)},getLineNumber:function(e){return X(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=A(this,e)),lt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return H(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ge(function(e,t,i){Ts(this,H(this,typeof e=="number"?b(e,t||0):e),null,i)}),setSelection:ge(function(e,t,i){Ts(this,H(this,e),H(this,t||e),i)}),extendSelection:ge(function(e,t,i){gn(this,H(this,e),t&&H(this,t),i)}),extendSelections:ge(function(e,t){Cs(this,nr(this,e),t)}),extendSelectionsBy:ge(function(e,t){var i=Nt(this.sel.ranges,e);Cs(this,nr(this,i),t)}),setSelections:ge(function(e,t,i){if(e.length){for(var r=[],n=0;n<e.length;n++)r[n]=new Y(H(this,e[n].anchor),H(this,e[n].head||e[n].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Te(this,ut(this.cm,r,t),i)}}),addSelection:ge(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Y(H(this,e),H(this,t||e))),Te(this,ut(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=It(this,t[r].from(),t[r].to());i=i?i.concat(n):n}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=It(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:ge(function(e,t,i){for(var r=[],n=this.sel,o=0;o<n.ranges.length;o++){var s=n.ranges[o];r[o]={from:s.from(),to:s.to(),text:this.splitLines(e[o]),origin:i}}for(var l=t&&t!="end"&&pa(this,r,t),a=r.length-1;a>=0;a--)Zr(this,r[a]);l?Ls(this,l):this.cm&&Xr(this.cm)}),undo:ge(function(){xn(this,"undo")}),redo:ge(function(){xn(this,"redo")}),undoSelection:ge(function(){xn(this,"undo",!0)}),redoSelection:ge(function(){xn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new pn(this.history),fr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Kr(this.history.done),undone:Kr(this.history.undone)}},setHistory:function(e){var t=this.history=new pn(this.history);t.done=Kr(e.done.slice(0),null,!0),t.undone=Kr(e.undone.slice(0),null,!0)},setGutterMarker:ge(function(e,t,i){return Ai(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Hr(n)&&(r.gutterMarkers=null),!0})}),clearGutter:ge(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Ai(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Hr(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!rr(this,e)||(t=e,e=A(this,e),!e))return null}else if(t=X(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:ge(function(e,t,i){return Ai(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(Yt(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:ge(function(e,t,i){return Ai(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",o=r[n];if(o)if(i==null)r[n]=null;else{var s=o.match(Yt(i));if(!s)return!1;var l=s.index+s[0].length;r[n]=o.slice(0,s.index)+(!s.index||l==o.length?"":" ")+o.slice(l)||null}else return!1;return!0})}),addLineWidget:ge(function(e,t,i){return Ca(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Jr(this,H(this,e),H(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=H(this,e),Jr(this,e,e,i,"bookmark")},findMarksAt:function(e){e=H(this,e);var t=[],i=A(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=H(this,e),t=H(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(o){var s=o.markedSpans;if(s)for(var l=0;l<s.length;l++){var a=s[l];!(a.to!=null&&n==e.line&&e.ch>=a.to||a.from==null&&n!=e.line||a.from!=null&&n==t.line&&a.from>=t.ch)&&(!i||i(a.marker))&&r.push(a.marker.parent||a.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var o=n.text.length+r;if(o>e)return t=e,!0;e-=o,++i}),H(this,b(i,t))},indexFromPos:function(e){e=H(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new Re(Rr(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new Re(Rr(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],La(r,zs(this)),r},unlinkDoc:function(e){if(e instanceof V&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),ka(zs(this));break}}if(e.history==this.history){var r=[e.id];fr(e,function(n){return r.push(n.id)},!0),e.history=new pn(null),e.history.done=Kr(this.history.done,r),e.history.undone=Kr(this.history.undone,r)}},iterLinkedDocs:function(e){fr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Et(e)},lineSeparator:function(){return this.lineSep||`
17
- `},setDirection:ge(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&va(this.cm))})}),Re.prototype.eachLine=Re.prototype.iter;var Bs=0;function Da(e){var t=this;if(Gs(t),!(le(t,e)||Ut(t.display,e))){de(e),M&&(Bs=+new Date);var i=wr(t,e,!0),r=e.dataTransfer.files;if(!(!i||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,o=Array(n),s=0,l=function(){++s==n&&ve(t,function(){i=H(t.doc,i);var v={from:i,to:i,text:t.doc.splitLines(o.filter(function(y){return y!=null}).join(t.doc.lineSeparator())),origin:"paste"};Zr(t.doc,v),Ls(t.doc,ar(H(t.doc,i),H(t.doc,ur(v))))})()},a=function(v,y){if(t.options.allowDropFileTypes&&he(t.options.allowDropFileTypes,v.type)==-1){l();return}var x=new FileReader;x.onerror=function(){return l()},x.onload=function(){var w=x.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(w)){l();return}o[y]=w,l()},x.readAsText(v)},u=0;u<r.length;u++)a(r[u],u);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),mn(t.doc,ar(i,i)),d)for(var g=0;g<d.length;++g)Qr(t.doc,"",d[g].anchor,d[g].head,"drag");t.replaceSelection(c,"around","paste"),t.display.input.focus()}}catch{}}}}function Na(e,t){if(M&&(!e.state.draggingText||+new Date-Bs<100)){ae(t);return}if(!(le(e,t)||Ut(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!Tt)){var i=E("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",ne&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),ne&&i.parentNode.removeChild(i)}}function Aa(e,t){var i=wr(e,t);if(i){var r=document.createDocumentFragment();Kn(e,i,r),e.display.dragCursor||(e.display.dragCursor=E("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Ee(e.display.dragCursor,r)}}function Gs(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Us(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var o=0;o<i.length;o++)e(i[o])})}}var _s=!1;function Oa(){_s||(Ea(),_s=!0)}function Ea(){var e;I(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Us(Pa)},100))}),I(window,"blur",function(){return Us(qr)})}function Pa(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var cr={3:"Pause",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:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Hi=0;Hi<10;Hi++)cr[Hi+48]=cr[Hi+96]=String(Hi);for(var bn=65;bn<=90;bn++)cr[bn]=String.fromCharCode(bn);for(var Ii=1;Ii<=12;Ii++)cr[Ii+111]=cr[Ii+63235]="F"+Ii;var qt={};qt.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},qt.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","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","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},qt.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},qt.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","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","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},qt.default=Ae?qt.macDefault:qt.pcDefault;function Wa(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,o,s=0;s<t.length-1;s++){var l=t[s];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))i=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))n=!0;else throw new Error("Unrecognized modifier name: "+l)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),o&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Ha(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=Nt(i.split(" "),Wa),o=0;o<n.length;o++){var s=void 0,l=void 0;o==n.length-1?(l=n.join(" "),s=r):(l=n.slice(0,o+1).join(" "),s="...");var a=t[l];if(!a)t[l]=s;else if(a!=s)throw new Error("Inconsistent bindings for "+l)}delete e[i]}for(var u in t)e[u]=t[u];return e}function Vr(e,t,i,r){t=Sn(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Vr(e,t.fallthrough,i,r);for(var o=0;o<t.fallthrough.length;o++){var s=Vr(e,t.fallthrough[o],i,r);if(s)return s}}}function qs(e){var t=typeof e=="string"?e:cr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Xs(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(Oe?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(Oe?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Ys(e,t){if(ne&&e.keyCode==34&&e.char)return!1;var i=cr[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),Xs(i,e,t))}function Sn(e){return typeof e=="string"?qt[e]:e}function $r(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var o=t(i[n]);r.length&&F(o.from,U(r).to)<=0;){var s=r.pop();if(F(s.from,o.from)<0){o.from=s.from;break}}r.push(o)}qe(e,function(){for(var l=r.length-1;l>=0;l--)Qr(e.doc,"",r[l].from,r[l].to,"+delete");Xr(e)})}function fo(e,t,i){var r=Ve(e.text,t+i,i);return r<0||r>e.text.length?null:r}function ho(e,t,i){var r=fo(e,t.ch,i);return r==null?null:new b(t.line,r,i<0?"after":"before")}function co(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var o=Ye(i,t.doc.direction);if(o){var s=n<0?U(o):o[0],l=n<0==(s.level==1),a=l?"after":"before",u;if(s.level>0||t.doc.direction=="rtl"){var c=Gr(t,i);u=n<0?i.text.length-1:0;var d=wt(t,c,u).top;u=Jt(function(g){return wt(t,c,g).top==d},n<0==(s.level==1)?s.from:s.to-1,u),a=="before"&&(u=fo(i,u,1))}else u=n<0?s.to:s.from;return new b(r,u,a)}}return new b(r,n<0?i.text.length:0,n<0?"before":"after")}function Ia(e,t,i,r){var n=Ye(t,e.doc.direction);if(!n)return ho(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var o=$e(n,i.ch,i.sticky),s=n[o];if(e.doc.direction=="ltr"&&s.level%2==0&&(r>0?s.to>i.ch:s.from<i.ch))return ho(t,i,r);var l=function(T,D){return fo(t,T instanceof b?T.ch:T,D)},a,u=function(T){return e.options.lineWrapping?(a=a||Gr(e,t),Jo(e,t,a,T)):{begin:0,end:t.text.length}},c=u(i.sticky=="before"?l(i,-1):i.ch);if(e.doc.direction=="rtl"||s.level==1){var d=s.level==1==r<0,g=l(i,d?1:-1);if(g!=null&&(d?g<=s.to&&g<=c.end:g>=s.from&&g>=c.begin)){var v=d?"before":"after";return new b(i.line,g,v)}}var y=function(T,D,L){for(var N=function(Z,me){return me?new b(i.line,l(Z,1),"before"):new b(i.line,Z,"after")};T>=0&&T<n.length;T+=D){var W=n[T],O=D>0==(W.level!=1),_=O?L.begin:l(L.end,-1);if(W.from<=_&&_<W.to||(_=O?W.from:l(W.to,-1),L.begin<=_&&_<L.end))return N(_,O)}},x=y(o+r,r,c);if(x)return x;var w=r>0?c.end:l(c.begin,-1);return w!=null&&!(r>0&&w==t.text.length)&&(x=y(r>0?0:n.length-1,r,u(w)),x)?x:null}var Fi={selectAll:As,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Je)},killLine:function(e){return $r(e,function(t){if(t.empty()){var i=A(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:b(t.head.line+1,0)}:{from:t.head,to:b(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return $r(e,function(t){return{from:b(t.from().line,0),to:H(e.doc,b(t.to().line+1,0))}})},delLineLeft:function(e){return $r(e,function(t){return{from:b(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return $r(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return $r(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(b(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(b(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Ks(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return js(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Fa(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Pe)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Pe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?js(e,t.head):r},Pe)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var o=i[n].from(),s=ke(e.getLine(o.line),o.ch,r);t.push(Zt(r-s%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return qe(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++)if(t[r].empty()){var n=t[r].head,o=A(e.doc,n.line).text;if(o){if(n.ch==o.length&&(n=new b(n.line,n.ch-1)),n.ch>0)n=new b(n.line,n.ch+1),e.replaceRange(o.charAt(n.ch-1)+o.charAt(n.ch-2),b(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var s=A(e.doc,n.line-1).text;s&&(n=new b(n.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+s.charAt(s.length-1),b(n.line-1,s.length-1),n,"+transpose"))}}i.push(new Y(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return qe(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Xr(e)})},openLine:function(e){return e.replaceSelection(`
18
- `,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Ks(e,t){var i=A(e.doc,t),r=lt(i);return r!=i&&(t=X(r)),co(!0,e,r,t,1)}function Fa(e,t){var i=A(e.doc,t),r=bl(i);return r!=i&&(t=X(r)),co(!0,e,i,t,-1)}function js(e,t){var i=Ks(e,t.line),r=A(e.doc,i.line),n=Ye(r,e.doc.direction);if(!n||n[0].level==0){var o=Math.max(i.ch,r.text.search(/\S/)),s=t.line==i.line&&t.ch<=o&&t.ch;return b(i.line,s?0:o,i.sticky)}return i}function wn(e,t,i){if(typeof t=="string"&&(t=Fi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=jt}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Ra(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=Vr(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&Vr(t,e.options.extraKeys,i,e)||Vr(t,e.options.keyMap,i,e)}var za=new xt;function Ri(e,t,i,r){var n=e.state.keySeq;if(n){if(qs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:za.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),Zs(e,n+" "+t,i,r))return!0}return Zs(e,t,i,r)}function Zs(e,t,i,r){var n=Ra(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&pe(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(de(i),jn(e)),!!n}function Qs(e,t){var i=Ys(t,!0);return i?t.shiftKey&&!e.state.keySeq?Ri(e,"Shift-"+i,t,function(r){return wn(e,r,!0)})||Ri(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return wn(e,r)}):Ri(e,i,t,function(r){return wn(e,r)}):!1}function Ba(e,t,i){return Ri(e,"'"+i+"'",t,function(r){return wn(e,r,!0)})}var po=null;function Js(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=we(mt(t)),!le(t,e))){M&&z<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=Qs(t,e);ne&&(po=r?i:null,!r&&i==88&&!Pt&&(Ae?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),Q&&!Ae&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ga(t)}}function Ga(e){var t=e.display.lineDiv;nt(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(kt(t,"CodeMirror-crosshair"),We(document,"keyup",i),We(document,"mouseover",i))}I(document,"keyup",i),I(document,"mouseover",i)}function Vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),le(this,e)}function $s(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(Ut(t.display,e)||le(t,e)||e.ctrlKey&&!e.altKey||Ae&&e.metaKey)){var i=e.keyCode,r=e.charCode;if(ne&&i==po){po=null,de(e);return}if(!(ne&&(!e.which||e.which<10)&&Qs(t,e))){var n=String.fromCharCode(r??i);n!="\b"&&(Ba(t,e,n)||t.display.input.onKeyPress(e))}}}var Ua=400,vo=function(e,t,i){this.time=e,this.pos=t,this.button=i};vo.prototype.compare=function(e,t,i){return this.time+Ua>e&&F(t,this.pos)==0&&i==this.button};var zi,Bi;function _a(e,t){var i=+new Date;return Bi&&Bi.compare(i,e,t)?(zi=Bi=null,"triple"):zi&&zi.compare(i,e,t)?(Bi=new vo(i,e,t),zi=null,"double"):(zi=new vo(i,e,t),Bi=null,"single")}function el(e){var t=this,i=t.display;if(!(le(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,Ut(i,e)){q||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!go(t,e)){var r=wr(t,e),n=te(e),o=r?_a(r,n):"single";Or(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&qa(t,n,r,o,e))&&(n==1?r?Ya(t,r,o,e):ot(e)==i.scroller&&de(e):n==2?(r&&gn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(ni?t.display.input.onContextMenu(e):Zn(t)))}}}function qa(e,t,i,r,n){var o="Click";return r=="double"?o="Double"+o:r=="triple"&&(o="Triple"+o),o=(t==1?"Left":t==2?"Middle":"Right")+o,Ri(e,Xs(o,n),n,function(s){if(typeof s=="string"&&(s=Fi[s]),!s)return!1;var l=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),l=s(e,i)!=jt}finally{e.state.suppressEdits=!1}return l})}function Xa(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var o=Ar?i.shiftKey&&i.metaKey:i.altKey;n.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=Ae?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(Ae?i.altKey:i.ctrlKey)),n}function Ya(e,t,i,r){M?setTimeout(Kt(ts,e),0):e.curOp.focus=we(mt(e));var n=Xa(e,i,r),o=e.doc.sel,s;e.options.dragDrop&&Me&&!e.isReadOnly()&&i=="single"&&(s=o.contains(t))>-1&&(F((s=o.ranges[s]).from(),t)<0||t.xRel>0)&&(F(s.to(),t)>0||t.xRel<0)?Ka(e,r,t,n):ja(e,r,t,n)}function Ka(e,t,i,r){var n=e.display,o=!1,s=ve(e,function(u){q&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Zn(e)),We(n.wrapper.ownerDocument,"mouseup",s),We(n.wrapper.ownerDocument,"mousemove",l),We(n.scroller,"dragstart",a),We(n.scroller,"drop",s),o||(de(u),r.addNew||gn(e.doc,i,null,null,r.extend),q&&!Tt||M&&z==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),l=function(u){o=o||Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)>=10},a=function(){return o=!0};q&&(n.scroller.draggable=!0),e.state.draggingText=s,s.copy=!r.moveOnDrag,I(n.wrapper.ownerDocument,"mouseup",s),I(n.wrapper.ownerDocument,"mousemove",l),I(n.scroller,"dragstart",a),I(n.scroller,"drop",s),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function tl(e,t,i){if(i=="char")return new Y(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Y(b(t.line,0),H(e.doc,b(t.line+1,0)));var r=i(e,t);return new Y(r.from,r.to)}function ja(e,t,i,r){M&&Zn(e);var n=e.display,o=e.doc;de(t);var s,l,a=o.sel,u=a.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(i),l>-1?s=u[l]:s=new Y(i,i)):(s=o.sel.primary(),l=o.sel.primIndex),r.unit=="rectangle")r.addNew||(s=new Y(i,i)),i=wr(e,t,!0,!0),l=-1;else{var c=tl(e,i,r.unit);r.extend?s=ao(s,c.anchor,c.head,r.extend):s=c}r.addNew?l==-1?(l=u.length,Te(o,ut(e,u.concat([s]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&r.unit=="char"&&!r.extend?(Te(o,ut(e,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),a=o.sel):uo(o,l,s,si):(l=0,Te(o,new Qe([s],0),si),a=o.sel);var d=i;function g(L){if(F(d,L)!=0)if(d=L,r.unit=="rectangle"){for(var N=[],W=e.options.tabSize,O=ke(A(o,i.line).text,i.ch,W),_=ke(A(o,L.line).text,L.ch,W),Z=Math.min(O,_),me=Math.max(O,_),ee=Math.min(i.line,L.line),Xe=Math.min(e.lastLine(),Math.max(i.line,L.line));ee<=Xe;ee++){var ze=A(o,ee).text,ue=Er(ze,Z,W);Z==me?N.push(new Y(b(ee,ue),b(ee,ue))):ze.length>ue&&N.push(new Y(b(ee,ue),b(ee,Er(ze,me,W))))}N.length||N.push(new Y(i,i)),Te(o,ut(e,a.ranges.slice(0,l).concat(N),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(L)}else{var Be=s,be=tl(e,L,r.unit),ce=Be.anchor,fe;F(be.anchor,ce)>0?(fe=be.head,ce=Ce(Be.from(),be.anchor)):(fe=be.anchor,ce=Rt(Be.to(),be.head));var ie=a.ranges.slice(0);ie[l]=Za(e,new Y(H(o,ce),fe)),Te(o,ut(e,ie,l),si)}}var v=n.wrapper.getBoundingClientRect(),y=0;function x(L){var N=++y,W=wr(e,L,!0,r.unit=="rectangle");if(W)if(F(W,d)!=0){e.curOp.focus=we(mt(e)),g(W);var O=fn(n,o);(W.line>=O.to||W.line<O.from)&&setTimeout(ve(e,function(){y==N&&x(L)}),150)}else{var _=L.clientY<v.top?-20:L.clientY>v.bottom?20:0;_&&setTimeout(ve(e,function(){y==N&&(n.scroller.scrollTop+=_,x(L))}),50)}}function w(L){e.state.selectingText=!1,y=1/0,L&&(de(L),n.input.focus()),We(n.wrapper.ownerDocument,"mousemove",T),We(n.wrapper.ownerDocument,"mouseup",D),o.history.lastSelOrigin=null}var T=ve(e,function(L){L.buttons===0||!te(L)?w(L):x(L)}),D=ve(e,w);e.state.selectingText=D,I(n.wrapper.ownerDocument,"mousemove",T),I(n.wrapper.ownerDocument,"mouseup",D)}function Za(e,t){var i=t.anchor,r=t.head,n=A(e.doc,i.line);if(F(i,r)==0&&i.sticky==r.sticky)return t;var o=Ye(n);if(!o)return t;var s=$e(o,i.ch,i.sticky),l=o[s];if(l.from!=i.ch&&l.to!=i.ch)return t;var a=s+(l.from==i.ch==(l.level!=1)?0:1);if(a==0||a==o.length)return t;var u;if(r.line!=i.line)u=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var c=$e(o,r.ch,r.sticky),d=c-s||(r.ch-i.ch)*(l.level==1?-1:1);c==a-1||c==a?u=d<0:u=d>0}var g=o[a+(u?-1:0)],v=u==(g.level==1),y=v?g.from:g.to,x=v?"after":"before";return i.ch==y&&i.sticky==x?t:new Y(new b(i.line,y,x),r)}function rl(e,t,i,r){var n,o;if(t.touches)n=t.touches[0].clientX,o=t.touches[0].clientY;else try{n=t.clientX,o=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&de(t);var s=e.display,l=s.lineDiv.getBoundingClientRect();if(o>l.bottom||!xe(e,i))return ci(t);o-=l.top-s.viewOffset;for(var a=0;a<e.display.gutterSpecs.length;++a){var u=s.gutters.childNodes[a];if(u&&u.getBoundingClientRect().right>=n){var c=bt(e.doc,o),d=e.display.gutterSpecs[a];return $(e,i,e,c,d.className,t),ci(t)}}}function go(e,t){return rl(e,t,"gutterClick",!0)}function il(e,t){Ut(e.display,t)||Qa(e,t)||le(e,t,"contextmenu")||ni||e.display.input.onContextMenu(t)}function Qa(e,t){return xe(e,"gutterContextMenu")?rl(e,t,"gutterContextMenu",!1):!1}function nl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),bi(e)}var ei={toString:function(){return"CodeMirror.Init"}},ol={},Cn={};function Ja(e){var t=e.optionHandlers;function i(r,n,o,s){e.defaults[r]=n,o&&(t[r]=s?function(l,a,u){u!=ei&&o(l,a,u)}:o)}e.defineOption=i,e.Init=ei,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,oo(r)},!0),i("indentUnit",2,oo,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Di(r),bi(r),Fe(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var o=[],s=r.doc.first;r.doc.iter(function(a){for(var u=0;;){var c=a.text.indexOf(n,u);if(c==-1)break;u=c+n.length,o.push(b(s,c))}s++});for(var l=o.length-1;l>=0;l--)Qr(r.doc,n,o[l],b(o[l].line,o[l].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,o){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),o!=ei&&r.refresh()}),i("specialCharPlaceholder",kl,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",ct?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!Mn),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){nl(r),Mi(r)},!0),i("keyMap","default",function(r,n,o){var s=Sn(n),l=o!=ei&&Sn(o);l&&l.detach&&l.detach(r,s),s.attach&&s.attach(r,l||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,$a,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=io(n,r.options.lineNumbers),Mi(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Xn(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Yr(r)},!0),i("scrollbarStyle","native",function(r){ls(r),Yr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=io(r.options.gutters,n),Mi(r)},!0),i("firstLineNumber",1,Mi,!0),i("lineNumberFormatter",function(r){return r},Mi,!0),i("showCursorWhenSelecting",!1,Si,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(qr(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Va),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Si,!0),i("singleCursorHeightPerLine",!0,Si,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Di,!0),i("addModeClass",!1,Di,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Di,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Va(e,t,i){var r=i&&i!=ei;if(!t!=!r){var n=e.display.dragFunctions,o=t?I:We;o(e.display.scroller,"dragstart",n.start),o(e.display.scroller,"dragenter",n.enter),o(e.display.scroller,"dragover",n.over),o(e.display.scroller,"dragleave",n.leave),o(e.display.scroller,"drop",n.drop)}}function $a(e){e.options.lineWrapping?(nt(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(kt(e.display.wrapper,"CodeMirror-wrap"),Hn(e)),Yn(e),Fe(e),bi(e),setTimeout(function(){return Yr(e)},100)}function V(e,t){var i=this;if(!(this instanceof V))return new V(e,t);this.options=t=t?Dt(t):{},Dt(ol,t,!1);var r=t.value;typeof r=="string"?r=new Re(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new V.inputStyles[t.inputStyle](this),o=this.display=new ca(e,r,n,t);o.wrapper.CodeMirror=this,nl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ls(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new xt,keySeq:null,specialChars:null},t.autofocus&&!ct&&o.input.focus(),M&&z<11&&setTimeout(function(){return i.display.input.reset(!0)},20),eu(this),Oa(),kr(this),this.curOp.forceUpdate=!0,ms(this,r),t.autofocus&&!ct||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Qn(i)},20):qr(this);for(var s in Cn)Cn.hasOwnProperty(s)&&Cn[s](this,t[s],ei);fs(this),t.finishInit&&t.finishInit(this);for(var l=0;l<mo.length;++l)mo[l](this);Mr(this),q&&t.lineWrapping&&getComputedStyle(o.lineDiv).textRendering=="optimizelegibility"&&(o.lineDiv.style.textRendering="auto")}V.defaults=ol,V.optionHandlers=Cn;function eu(e){var t=e.display;I(t.scroller,"mousedown",ve(e,el)),M&&z<11?I(t.scroller,"dblclick",ve(e,function(a){if(!le(e,a)){var u=wr(e,a);if(!(!u||go(e,a)||Ut(e.display,a))){de(a);var c=e.findWordAt(u);gn(e.doc,c.anchor,c.head)}}})):I(t.scroller,"dblclick",function(a){return le(e,a)||de(a)}),I(t.scroller,"contextmenu",function(a){return il(e,a)}),I(t.input.getField(),"contextmenu",function(a){t.scroller.contains(a.target)||il(e,a)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function o(a){if(a.touches.length!=1)return!1;var u=a.touches[0];return u.radiusX<=1&&u.radiusY<=1}function s(a,u){if(u.left==null)return!0;var c=u.left-a.left,d=u.top-a.top;return c*c+d*d>400}I(t.scroller,"touchstart",function(a){if(!le(e,a)&&!o(a)&&!go(e,a)){t.input.ensurePolled(),clearTimeout(i);var u=+new Date;t.activeTouch={start:u,moved:!1,prev:u-r.end<=300?r:null},a.touches.length==1&&(t.activeTouch.left=a.touches[0].pageX,t.activeTouch.top=a.touches[0].pageY)}}),I(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),I(t.scroller,"touchend",function(a){var u=t.activeTouch;if(u&&!Ut(t,a)&&u.left!=null&&!u.moved&&new Date-u.start<300){var c=e.coordsChar(t.activeTouch,"page"),d;!u.prev||s(u,u.prev)?d=new Y(c,c):!u.prev.prev||s(u,u.prev.prev)?d=e.findWordAt(c):d=new Y(b(c.line,0),H(e.doc,b(c.line+1,0))),e.setSelection(d.anchor,d.head),e.focus(),de(a)}n()}),I(t.scroller,"touchcancel",n),I(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ci(e,t.scroller.scrollTop),Tr(e,t.scroller.scrollLeft,!0),$(e,"scroll",e))}),I(t.scroller,"mousewheel",function(a){return ds(e,a)}),I(t.scroller,"DOMMouseScroll",function(a){return ds(e,a)}),I(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(a){le(e,a)||ae(a)},over:function(a){le(e,a)||(Aa(e,a),ae(a))},start:function(a){return Na(e,a)},drop:ve(e,Da),leave:function(a){le(e,a)||Gs(e)}};var l=t.input.getField();I(l,"keyup",function(a){return Vs.call(e,a)}),I(l,"keydown",ve(e,Js)),I(l,"keypress",ve(e,$s)),I(l,"focus",function(a){return Qn(e,a)}),I(l,"blur",function(a){return qr(e,a)})}var mo=[];V.defineInitHook=function(e){return mo.push(e)};function Gi(e,t,i,r){var n=e.doc,o;i==null&&(i="add"),i=="smart"&&(n.mode.indent?o=f(e,t).state:i="prev");var s=e.options.tabSize,l=A(n,t),a=ke(l.text,null,s);l.stateAfter&&(l.stateAfter=null);var u=l.text.match(/^\s*/)[0],c;if(!r&&!/\S/.test(l.text))c=0,i="not";else if(i=="smart"&&(c=n.mode.indent(o,l.text.slice(u.length),l.text),c==jt||c>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?c=ke(A(n,t-1).text,null,s):c=0:i=="add"?c=a+e.options.indentUnit:i=="subtract"?c=a-e.options.indentUnit:typeof i=="number"&&(c=a+i),c=Math.max(0,c);var d="",g=0;if(e.options.indentWithTabs)for(var v=Math.floor(c/s);v;--v)g+=s,d+=" ";if(g<c&&(d+=Zt(c-g)),d!=u)return Qr(n,d,b(t,0),b(t,u.length),"+input"),l.stateAfter=null,!0;for(var y=0;y<n.sel.ranges.length;y++){var x=n.sel.ranges[y];if(x.head.line==t&&x.head.ch<u.length){var w=b(t,u.length);uo(n,y,new Y(w,w));break}}}var ft=null;function Tn(e){ft=e}function yo(e,t,i,r,n){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var s=+new Date-200,l=n=="paste"||e.state.pasteIncoming>s,a=Et(t),u=null;if(l&&r.ranges.length>1)if(ft&&ft.text.join(`
19
- `)==t){if(r.ranges.length%ft.text.length==0){u=[];for(var c=0;c<ft.text.length;c++)u.push(o.splitLines(ft.text[c]))}}else a.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=Nt(a,function(T){return[T]}));for(var d=e.curOp.updateInput,g=r.ranges.length-1;g>=0;g--){var v=r.ranges[g],y=v.from(),x=v.to();v.empty()&&(i&&i>0?y=b(y.line,y.ch-i):e.state.overwrite&&!l?x=b(x.line,Math.min(A(o,x.line).text.length,x.ch+U(a).length)):l&&ft&&ft.lineWise&&ft.text.join(`
20
- `)==a.join(`
21
- `)&&(y=x=b(y.line,0)));var w={from:y,to:x,text:u?u[g%u.length]:a,origin:n||(l?"paste":e.state.cutIncoming>s?"cut":"+input")};Zr(e.doc,w),pe(e,"inputRead",e,w)}t&&!l&&ll(e,t),Xr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function sl(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&qe(t,function(){return yo(t,i,0,null,"paste")}),!0}function ll(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var o=e.getModeAt(n.head),s=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){s=Gi(e,n.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(A(e.doc,n.head.line).text.slice(0,n.head.ch))&&(s=Gi(e,n.head.line,"smart"));s&&pe(e,"electricInput",e,n.head.line)}}}function al(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,o={anchor:b(n,0),head:b(n+1,0)};i.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:i}}function xo(e,t,i,r){e.setAttribute("autocorrect",i?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function ul(){var e=E("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=E("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return q?e.style.width="1000px":e.setAttribute("wrap","off"),ht&&(e.style.border="1px solid black"),t}function tu(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){Or(this).focus(),this.display.input.focus()},setOption:function(r,n){var o=this.options,s=o[r];o[r]==n&&r!="mode"||(o[r]=n,t.hasOwnProperty(r)&&ve(this,t[r])(this,n,s),$(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](Sn(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,o=0;o<n.length;++o)if(n[o]==r||n[o].name==r)return n.splice(o,1),!0},addOverlay:De(function(r,n){var o=r.token?r:e.getMode(this.options,r);if(o.startState)throw new Error("Overlays may not be stateful.");li(this.state.overlays,{mode:o,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(s){return s.priority}),this.state.modeGen++,Fe(this)}),removeOverlay:De(function(r){for(var n=this.state.overlays,o=0;o<n.length;++o){var s=n[o].modeSpec;if(s==r||typeof r=="string"&&s.name==r){n.splice(o,1),this.state.modeGen++,Fe(this);return}}}),indentLine:De(function(r,n,o){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),rr(this.doc,r)&&Gi(this,r,n,o)}),indentSelection:De(function(r){for(var n=this.doc.sel.ranges,o=-1,s=0;s<n.length;s++){var l=n[s];if(l.empty())l.head.line>o&&(Gi(this,l.head.line,r,!0),o=l.head.line,s==this.doc.sel.primIndex&&Xr(this));else{var a=l.from(),u=l.to(),c=Math.max(o,a.line);o=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var d=c;d<o;++d)Gi(this,d,r);var g=this.doc.sel.ranges;a.ch==0&&n.length==g.length&&g[s].from().ch>0&&uo(this.doc,s,new Y(a,g[s].to()),Je)}}}),getTokenAt:function(r,n){return P(this,r,n)},getLineTokens:function(r,n){return P(this,b(r),n,!0)},getTokenTypeAt:function(r){r=H(this.doc,r);var n=Qi(this,A(this.doc,r.line)),o=0,s=(n.length-1)/2,l=r.ch,a;if(l==0)a=n[2];else for(;;){var u=o+s>>1;if((u?n[u*2-1]:0)>=l)s=u;else if(n[u*2+1]<l)o=u+1;else{a=n[u*2+2];break}}var c=a?a.indexOf("overlay "):-1;return c<0?a:c==0?null:a.slice(0,c-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var o=[];if(!i.hasOwnProperty(n))return o;var s=i[n],l=this.getModeAt(r);if(typeof l[n]=="string")s[l[n]]&&o.push(s[l[n]]);else if(l[n])for(var a=0;a<l[n].length;a++){var u=s[l[n][a]];u&&o.push(u)}else l.helperType&&s[l.helperType]?o.push(s[l.helperType]):s[l.name]&&o.push(s[l.name]);for(var c=0;c<s._global.length;c++){var d=s._global[c];d.pred(l,this)&&he(o,d.val)==-1&&o.push(d.val)}return o},getStateAfter:function(r,n){var o=this.doc;return r=zt(o,r??o.first+o.size-1),f(this,r+1,n).state},cursorCoords:function(r,n){var o,s=this.doc.sel.primary();return r==null?o=s.head:typeof r=="object"?o=H(this.doc,r):o=r?s.from():s.to(),at(this,o,n||"page")},charCoords:function(r,n){return sn(this,H(this.doc,r),n||"page")},coordsChar:function(r,n){return r=jo(this,r,n||"page"),Un(this,r.left,r.top)},lineAtHeight:function(r,n){return r=jo(this,{top:r,left:0},n||"page").top,bt(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,o){var s=!1,l;if(typeof r=="number"){var a=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>a&&(r=a,s=!0),l=A(this.doc,r)}else l=r;return on(this,l,{top:0,left:0},n||"page",o||s).top+(s?this.doc.height-Gt(l):0)},defaultTextHeight:function(){return Ur(this.display)},defaultCharWidth:function(){return _r(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,o,s,l){var a=this.display;r=at(this,H(this.doc,r));var u=r.bottom,c=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),a.sizer.appendChild(n),s=="over")u=r.top;else if(s=="above"||s=="near"){var d=Math.max(a.wrapper.clientHeight,this.doc.height),g=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);(s=="above"||r.bottom+n.offsetHeight>d)&&r.top>n.offsetHeight?u=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=d&&(u=r.bottom),c+n.offsetWidth>g&&(c=g-n.offsetWidth)}n.style.top=u+"px",n.style.left=n.style.right="",l=="right"?(c=a.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(l=="left"?c=0:l=="middle"&&(c=(a.sizer.clientWidth-n.offsetWidth)/2),n.style.left=c+"px"),o&&Vl(this,{left:c,top:u,right:c+n.offsetWidth,bottom:u+n.offsetHeight})},triggerOnKeyDown:De(Js),triggerOnKeyPress:De($s),triggerOnKeyUp:Vs,triggerOnMouseDown:De(el),execCommand:function(r){if(Fi.hasOwnProperty(r))return Fi[r].call(null,this)},triggerElectric:De(function(r){ll(this,r)}),findPosH:function(r,n,o,s){var l=1;n<0&&(l=-1,n=-n);for(var a=H(this.doc,r),u=0;u<n&&(a=bo(this.doc,a,l,o,s),!a.hitSide);++u);return a},moveH:De(function(r,n){var o=this;this.extendSelectionsBy(function(s){return o.display.shift||o.doc.extend||s.empty()?bo(o.doc,s.head,r,n,o.options.rtlMoveVisually):r<0?s.from():s.to()},Pe)}),deleteH:De(function(r,n){var o=this.doc.sel,s=this.doc;o.somethingSelected()?s.replaceSelection("",null,"+delete"):$r(this,function(l){var a=bo(s,l.head,r,n,!1);return r<0?{from:a,to:l.head}:{from:l.head,to:a}})}),findPosV:function(r,n,o,s){var l=1,a=s;n<0&&(l=-1,n=-n);for(var u=H(this.doc,r),c=0;c<n;++c){var d=at(this,u,"div");if(a==null?a=d.left:d.left=a,u=fl(this,d,l,o),u.hitSide)break}return u},moveV:De(function(r,n){var o=this,s=this.doc,l=[],a=!this.display.shift&&!s.extend&&s.sel.somethingSelected();if(s.extendSelectionsBy(function(c){if(a)return r<0?c.from():c.to();var d=at(o,c.head,"div");c.goalColumn!=null&&(d.left=c.goalColumn),l.push(d.left);var g=fl(o,d,r,n);return n=="page"&&c==s.sel.primary()&&Vn(o,sn(o,g,"div").top-d.top),g},Pe),l.length)for(var u=0;u<s.sel.ranges.length;u++)s.sel.ranges[u].goalColumn=l[u]}),findWordAt:function(r){var n=this.doc,o=A(n,r.line).text,s=r.ch,l=r.ch;if(o){var a=this.getHelper(r,"wordChars");(r.sticky=="before"||l==o.length)&&s?--s:++l;for(var u=o.charAt(s),c=_e(u,a)?function(d){return _e(d,a)}:/\s/.test(u)?function(d){return/\s/.test(d)}:function(d){return!/\s/.test(d)&&!_e(d)};s>0&&c(o.charAt(s-1));)--s;for(;l<o.length&&c(o.charAt(l));)++l}return new Y(b(r.line,s),b(r.line,l))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?nt(this.display.cursorDiv,"CodeMirror-overwrite"):kt(this.display.cursorDiv,"CodeMirror-overwrite"),$(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==we(mt(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:De(function(r,n){wi(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-St(this)-this.display.barHeight,width:r.scrollWidth-St(this)-this.display.barWidth,clientHeight:Rn(this),clientWidth:br(this)}},scrollIntoView:De(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:b(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?$l(this,r):is(this,r.from,r.to,r.margin)}),setSize:De(function(r,n){var o=this,s=function(a){return typeof a=="number"||/^\d+$/.test(String(a))?a+"px":a};r!=null&&(this.display.wrapper.style.width=s(r)),n!=null&&(this.display.wrapper.style.height=s(n)),this.options.lineWrapping&&Xo(this);var l=this.display.viewFrom;this.doc.iter(l,this.display.viewTo,function(a){if(a.widgets){for(var u=0;u<a.widgets.length;u++)if(a.widgets[u].noHScroll){sr(o,l,"widget");break}}++l}),this.curOp.forceUpdate=!0,$(this,"refresh",this)}),operation:function(r){return qe(this,r)},startOperation:function(){return kr(this)},endOperation:function(){return Mr(this)},refresh:De(function(){var r=this.display.cachedTextHeight;Fe(this),this.curOp.forceUpdate=!0,bi(this),wi(this,this.doc.scrollLeft,this.doc.scrollTop),to(this.display),(r==null||Math.abs(r-Ur(this.display))>.5||this.options.lineWrapping)&&Yn(this),$(this,"refresh",this)}),swapDoc:De(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),ms(this,r),bi(this),this.display.input.reset(),wi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,pe(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Vt(e),e.registerHelper=function(r,n,o){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=o},e.registerGlobalHelper=function(r,n,o,s){e.registerHelper(r,n,s),i[r]._global.push({pred:o,val:s})}}function bo(e,t,i,r,n){var o=t,s=i,l=A(e,t.line),a=n&&e.direction=="rtl"?-i:i;function u(){var D=t.line+a;return D<e.first||D>=e.first+e.size?!1:(t=new b(D,t.ch,t.sticky),l=A(e,D))}function c(D){var L;if(r=="codepoint"){var N=l.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(N))L=null;else{var W=i>0?N>=55296&&N<56320:N>=56320&&N<57343;L=new b(t.line,Math.max(0,Math.min(l.text.length,t.ch+i*(W?2:1))),-i)}}else n?L=Ia(e.cm,l,t,i):L=ho(l,t,i);if(L==null)if(!D&&u())t=co(n,e.cm,l,t.line,a);else return!1;else t=L;return!0}if(r=="char"||r=="codepoint")c();else if(r=="column")c(!0);else if(r=="word"||r=="group")for(var d=null,g=r=="group",v=e.cm&&e.cm.getHelper(t,"wordChars"),y=!0;!(i<0&&!c(!y));y=!1){var x=l.text.charAt(t.ch)||`
22
- `,w=_e(x,v)?"w":g&&x==`
23
- `?"n":!g||/\s/.test(x)?null:"p";if(g&&!y&&!w&&(w="s"),d&&d!=w){i<0&&(i=1,c(),t.sticky="after");break}if(w&&(d=w),i>0&&!c(!y))break}var T=yn(e,t,o,s,!0);return Ft(o,T)&&(T.hitSide=!0),T}function fl(e,t,i,r){var n=e.doc,o=t.left,s;if(r=="page"){var l=Math.min(e.display.wrapper.clientHeight,Or(e).innerHeight||n(e).documentElement.clientHeight),a=Math.max(l-.5*Ur(e.display),3);s=(i>0?t.bottom:t.top)+i*a}else r=="line"&&(s=i>0?t.bottom+3:t.top-3);for(var u;u=Un(e,o,s),!!u.outside;){if(i<0?s<=0:s>=n.height){u.hitSide=!0;break}s+=i*5}return u}var K=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new xt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};K.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,xo(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function o(l){for(var a=l.target;a;a=a.parentNode){if(a==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(a.className))break}return!1}I(n,"paste",function(l){!o(l)||le(r,l)||sl(l,r)||z<=11&&setTimeout(ve(r,function(){return t.updateFromDOM()}),20)}),I(n,"compositionstart",function(l){t.composing={data:l.data,done:!1}}),I(n,"compositionupdate",function(l){t.composing||(t.composing={data:l.data,done:!1})}),I(n,"compositionend",function(l){t.composing&&(l.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),I(n,"touchstart",function(){return i.forceCompositionEnd()}),I(n,"input",function(){t.composing||t.readFromDOMSoon()});function s(l){if(!(!o(l)||le(r,l))){if(r.somethingSelected())Tn({lineWise:!1,text:r.getSelections()}),l.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var a=al(r);Tn({lineWise:!0,text:a.text}),l.type=="cut"&&r.operation(function(){r.setSelections(a.ranges,0,Je),r.replaceSelection("",null,"cut")})}else return;if(l.clipboardData){l.clipboardData.clearData();var u=ft.text.join(`
24
- `);if(l.clipboardData.setData("Text",u),l.clipboardData.getData("Text")==u){l.preventDefault();return}}var c=ul(),d=c.firstChild;xo(d),r.display.lineSpace.insertBefore(c,r.display.lineSpace.firstChild),d.value=ft.text.join(`
25
- `);var g=we(yt(n));pr(d),setTimeout(function(){r.display.lineSpace.removeChild(c),g.focus(),g==n&&i.showPrimarySelection()},50)}}I(n,"copy",s),I(n,"cut",s)},K.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},K.prototype.prepareSelection=function(){var e=es(this.cm,!1);return e.focus=we(yt(this.div))==this.div,e},K.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},K.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},K.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var o=Ln(t,e.anchorNode,e.anchorOffset),s=Ln(t,e.focusNode,e.focusOffset);if(!(o&&!o.bad&&s&&!s.bad&&F(Ce(o,s),r)==0&&F(Rt(o,s),n)==0)){var l=t.display.view,a=r.line>=t.display.viewFrom&&hl(t,r)||{node:l[0].measure.map[2],offset:0},u=n.line<t.display.viewTo&&hl(t,n);if(!u){var c=l[l.length-1].measure,d=c.maps?c.maps[c.maps.length-1]:c.map;u={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}}if(!a||!u){e.removeAllRanges();return}var g=e.rangeCount&&e.getRangeAt(0),v;try{v=vt(a.node,a.offset,u.offset,u.node)}catch{}v&&(!Q&&t.state.focused?(e.collapse(a.node,a.offset),v.collapsed||(e.removeAllRanges(),e.addRange(v))):(e.removeAllRanges(),e.addRange(v)),g&&e.anchorNode==null?e.addRange(g):Q&&this.startGracePeriod()),this.rememberSelection()}},K.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},K.prototype.showMultipleSelections=function(e){Ee(this.cm.display.cursorDiv,e.cursors),Ee(this.cm.display.selectionDiv,e.selection)},K.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},K.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return it(this.div,t)},K.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||we(yt(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},K.prototype.blur=function(){this.div.blur()},K.prototype.getField=function(){return this.div},K.prototype.supportsTouch=function(){return!0},K.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):qe(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function i(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,i))}this.polling.set(this.cm.options.pollInterval,i)},K.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},K.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(rt&&se&&this.cm.display.gutterSpecs.length&&ru(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var i=Ln(t,e.anchorNode,e.anchorOffset),r=Ln(t,e.focusNode,e.focusOffset);i&&r&&qe(t,function(){Te(t.doc,ar(i,r),Je),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},K.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=b(r.line-1,A(e.doc,r.line-1).length)),n.ch==A(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=b(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var o,s,l;r.line==t.viewFrom||(o=Cr(e,r.line))==0?(s=X(t.view[0].line),l=t.view[0].node):(s=X(t.view[o].line),l=t.view[o-1].node.nextSibling);var a=Cr(e,n.line),u,c;if(a==t.view.length-1?(u=t.viewTo-1,c=t.lineDiv.lastChild):(u=X(t.view[a+1].line)-1,c=t.view[a+1].node.previousSibling),!l)return!1;for(var d=e.doc.splitLines(iu(e,l,c,s,u)),g=It(e.doc,b(s,0),b(u,A(e.doc,u).text.length));d.length>1&&g.length>1;)if(U(d)==U(g))d.pop(),g.pop(),u--;else if(d[0]==g[0])d.shift(),g.shift(),s++;else break;for(var v=0,y=0,x=d[0],w=g[0],T=Math.min(x.length,w.length);v<T&&x.charCodeAt(v)==w.charCodeAt(v);)++v;for(var D=U(d),L=U(g),N=Math.min(D.length-(d.length==1?v:0),L.length-(g.length==1?v:0));y<N&&D.charCodeAt(D.length-y-1)==L.charCodeAt(L.length-y-1);)++y;if(d.length==1&&g.length==1&&s==r.line)for(;v&&v>r.ch&&D.charCodeAt(D.length-y-1)==L.charCodeAt(L.length-y-1);)v--,y++;d[d.length-1]=D.slice(0,D.length-y).replace(/^\u200b+/,""),d[0]=d[0].slice(v).replace(/\u200b+$/,"");var W=b(s,v),O=b(u,g.length?U(g).length-y:0);if(d.length>1||d[0]||F(W,O))return Qr(e.doc,d,W,O,"+input"),!0},K.prototype.ensurePolled=function(){this.forceCompositionEnd()},K.prototype.reset=function(){this.forceCompositionEnd()},K.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},K.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},K.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&qe(this.cm,function(){return Fe(e.cm)})},K.prototype.setUneditable=function(e){e.contentEditable="false"},K.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ve(this.cm,yo)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},K.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},K.prototype.onContextMenu=function(){},K.prototype.resetPosition=function(){},K.prototype.needsContentAttribute=!0;function hl(e,t){var i=zn(e,t.line);if(!i||i.hidden)return null;var r=A(e.doc,t.line),n=Bo(i,r,t.line),o=Ye(r,e.doc.direction),s="left";if(o){var l=$e(o,t.ch);s=l%2?"right":"left"}var a=_o(n.map,t.ch,s);return a.offset=a.collapse=="right"?a.end:a.start,a}function ru(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ti(e,t){return t&&(e.bad=!0),e}function iu(e,t,i,r,n){var o="",s=!1,l=e.doc.lineSeparator(),a=!1;function u(v){return function(y){return y.id==v}}function c(){s&&(o+=l,a&&(o+=l),s=a=!1)}function d(v){v&&(c(),o+=v)}function g(v){if(v.nodeType==1){var y=v.getAttribute("cm-text");if(y){d(y);return}var x=v.getAttribute("cm-marker"),w;if(x){var T=e.findMarks(b(r,0),b(n+1,0),u(+x));T.length&&(w=T[0].find(0))&&d(It(e.doc,w.from,w.to).join(l));return}if(v.getAttribute("contenteditable")=="false")return;var D=/^(pre|div|p|li|table|br)$/i.test(v.nodeName);if(!/^br$/i.test(v.nodeName)&&v.textContent.length==0)return;D&&c();for(var L=0;L<v.childNodes.length;L++)g(v.childNodes[L]);/^(pre|p)$/i.test(v.nodeName)&&(a=!0),D&&(s=!0)}else v.nodeType==3&&d(v.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;g(t),t!=i;)t=t.nextSibling,a=!1;return o}function Ln(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return ti(e.clipPos(b(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var o=e.display.view[n];if(o.node==r)return nu(o,t,i)}}function nu(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!it(r,t))return ti(b(X(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var o=e.rest?U(e.rest):e.line;return ti(b(X(o),o.text.length),n)}var s=t.nodeType==3?t:null,l=t;for(!s&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(s=t.firstChild,i&&(i=s.nodeValue.length));l.parentNode!=r;)l=l.parentNode;var a=e.measure,u=a.maps;function c(w,T,D){for(var L=-1;L<(u?u.length:0);L++)for(var N=L<0?a.map:u[L],W=0;W<N.length;W+=3){var O=N[W+2];if(O==w||O==T){var _=X(L<0?e.line:e.rest[L]),Z=N[W]+D;return(D<0||O!=w)&&(Z=N[W+(D?1:0)]),b(_,Z)}}}var d=c(s,l,i);if(d)return ti(d,n);for(var g=l.nextSibling,v=s?s.nodeValue.length-i:0;g;g=g.nextSibling){if(d=c(g,g.firstChild,0),d)return ti(b(d.line,d.ch-v),n);v+=g.textContent.length}for(var y=l.previousSibling,x=i;y;y=y.previousSibling){if(d=c(y,y.firstChild,-1),d)return ti(b(d.line,d.ch+x),n);x+=y.textContent.length}}var oe=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new xt,this.hasSelection=!1,this.composing=null,this.resetting=!1};oe.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),ht&&(n.style.width="0px"),I(n,"input",function(){M&&z>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),I(n,"paste",function(s){le(r,s)||sl(s,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function o(s){if(!le(r,s)){if(r.somethingSelected())Tn({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var l=al(r);Tn({lineWise:!0,text:l.text}),s.type=="cut"?r.setSelections(l.ranges,null,Je):(i.prevInput="",n.value=l.text.join(`
26
- `),pr(n))}else return;s.type=="cut"&&(r.state.cutIncoming=+new Date)}}I(n,"cut",o),I(n,"copy",o),I(e.scroller,"paste",function(s){if(!(Ut(e,s)||le(r,s))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var l=new Event("paste");l.clipboardData=s.clipboardData,n.dispatchEvent(l)}}),I(e.lineSpace,"selectstart",function(s){Ut(e,s)||de(s)}),I(n,"compositionstart",function(){var s=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:s,range:r.markText(s,r.getCursor("to"),{className:"CodeMirror-composing"})}}),I(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},oe.prototype.createField=function(e){this.wrapper=ul(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;xo(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},oe.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},oe.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=es(e);if(e.options.moveInputWithCursor){var n=at(e,i.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),s=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+s.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+s.left-o.left))}return r},oe.prototype.showSelection=function(e){var t=this.cm,i=t.display;Ee(i.cursorDiv,e.cursors),Ee(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},oe.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&pr(this.textarea),M&&z>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",M&&z>=9&&(this.hasSelection=null));this.resetting=!1}},oe.prototype.getField=function(){return this.textarea},oe.prototype.supportsTouch=function(){return!1},oe.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!ct||we(yt(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},oe.prototype.blur=function(){this.textarea.blur()},oe.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},oe.prototype.receivedFocus=function(){this.slowPoll()},oe.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},oe.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},oe.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||et(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(M&&z>=9&&this.hasSelection===n||Ae&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=n.charCodeAt(0);if(o==8203&&!r&&(r="\u200B"),o==8666)return this.reset(),this.cm.execCommand("undo")}for(var s=0,l=Math.min(r.length,n.length);s<l&&r.charCodeAt(s)==n.charCodeAt(s);)++s;return qe(t,function(){yo(t,n.slice(s),r.length-s,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
27
- `)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},oe.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},oe.prototype.onKeyPress=function(){M&&z>=9&&(this.hasSelection=null),this.fastPoll()},oe.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=wr(i,e),s=r.scroller.scrollTop;if(!o||ne)return;var l=i.options.resetSelectionOnContextMenu;l&&i.doc.sel.contains(o)==-1&&ve(i,Te)(i.doc,ar(o),Je);var a=n.style.cssText,u=t.wrapper.style.cssText,c=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
28
- top: `+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+`px;
29
- z-index: 1000; background: `+(M?"rgba(255, 255, 255, .05)":"transparent")+`;
30
- outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var d;q&&(d=n.ownerDocument.defaultView.scrollY),r.input.focus(),q&&n.ownerDocument.defaultView.scrollTo(null,d),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=v,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function g(){if(n.selectionStart!=null){var x=i.somethingSelected(),w="\u200B"+(x?n.value:"");n.value="\u21DA",n.value=w,t.prevInput=x?"":"\u200B",n.selectionStart=1,n.selectionEnd=w.length,r.selForContextMenu=i.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=u,n.style.cssText=a,M&&z<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=s),n.selectionStart!=null)){(!M||M&&z<9)&&g();var x=0,w=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?ve(i,As)(i):x++<10?r.detectingSelectAll=setTimeout(w,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(w,200)}}if(M&&z>=9&&g(),ni){ae(e);var y=function(){We(window,"mouseup",y),setTimeout(v,20)};I(window,"mouseup",y)}else setTimeout(v,50)},oe.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},oe.prototype.setUneditable=function(){},oe.prototype.needsContentAttribute=!1;function ou(e,t){if(t=t?Dt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=we(yt(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=l.getValue()}var n;if(e.form&&(I(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;n=o.submit;try{var s=o.submit=function(){r(),o.submit=n,o.submit(),o.submit=s}}catch{}}t.finishInit=function(a){a.save=r,a.getTextArea=function(){return e},a.toTextArea=function(){a.toTextArea=isNaN,r(),e.parentNode.removeChild(a.getWrapperElement()),e.style.display="",e.form&&(We(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var l=V(function(a){return e.parentNode.insertBefore(a,e.nextSibling)},t);return l}function su(e){e.off=We,e.on=I,e.wheelEventPixels=da,e.Doc=Re,e.splitLines=Et,e.countColumn=ke,e.findColumn=Er,e.isWordChar=Qt,e.Pass=jt,e.signal=$,e.Line=zr,e.changeEnd=ur,e.scrollbarModel=ss,e.Pos=b,e.cmpPos=F,e.modes=er,e.mimeModes=tr,e.resolveMode=Fr,e.getMode=di,e.modeExtensions=Wt,e.extendMode=ji,e.copyState=Ht,e.startState=Zi,e.innerMode=pi,e.commands=Fi,e.keyMap=qt,e.keyName=Ys,e.isModifierKey=qs,e.lookupKey=Vr,e.normalizeKeyMap=Ha,e.StringStream=re,e.SharedTextMarker=Wi,e.TextMarker=hr,e.LineWidget=Pi,e.e_preventDefault=de,e.e_stopPropagation=Yi,e.e_stop=ae,e.addClass=nt,e.contains=it,e.rmClass=kt,e.keyNames=cr}Ja(V),tu(V);var lu="iter insert remove copy getEditor constructor".split(" ");for(var kn in Re.prototype)Re.prototype.hasOwnProperty(kn)&&he(lu,kn)<0&&(V.prototype[kn]=(function(e){return function(){return e.apply(this.doc,arguments)}})(Re.prototype[kn]));return Vt(Re),V.inputStyles={textarea:oe,contenteditable:K},V.defineMode=function(e){!V.defaults.mode&&e!="null"&&(V.defaults.mode=e),Nn.apply(this,arguments)},V.defineMIME=An,V.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),V.defineMIME("text/plain","null"),V.defineExtension=function(e,t){V.prototype[e]=t},V.defineDocExtension=function(e,t){Re.prototype[e]=t},V.fromTextArea=ou,su(V),V.version="5.65.20",V})),(function(k){typeof exports=="object"&&typeof module=="object"?k(require("../lib/codemirror")):typeof define=="function"&&define.amd?define(["../lib/codemirror"],k):k(CodeMirror)})(function(k){"use strict";k.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var j=0;j<k.modeInfo.length;j++){var Q=k.modeInfo[j];Q.mimes&&(Q.mime=Q.mimes[0])}k.findModeByMIME=function(G){G=G.toLowerCase();for(var R=0;R<k.modeInfo.length;R++){var C=k.modeInfo[R];if(C.mime==G)return C;if(C.mimes){for(var M=0;M<C.mimes.length;M++)if(C.mimes[M]==G)return C}}if(/\+xml$/.test(G))return k.findModeByMIME("application/xml");if(/\+json$/.test(G))return k.findModeByMIME("application/json")},k.findModeByExtension=function(G){G=G.toLowerCase();for(var R=0;R<k.modeInfo.length;R++){var C=k.modeInfo[R];if(C.ext){for(var M=0;M<C.ext.length;M++)if(C.ext[M]==G)return C}}},k.findModeByFileName=function(G){for(var R=0;R<k.modeInfo.length;R++){var C=k.modeInfo[R];if(C.file&&C.file.test(G))return C}var M=G.lastIndexOf("."),z=M>-1&&G.substring(M+1,G.length);if(z)return k.findModeByExtension(z)},k.findModeByName=function(G){G=G.toLowerCase();for(var R=0;R<k.modeInfo.length;R++){var C=k.modeInfo[R];if(C.name.toLowerCase()==G)return C;if(C.alias){for(var M=0;M<C.alias.length;M++)if(C.alias[M].toLowerCase()==G)return C}}}}),(function(k){typeof exports=="object"&&typeof module=="object"?k(require("../../lib/codemirror"),"cjs"):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],function(j){k(j,"amd")}):k(CodeMirror,"plain")})(function(k,j){k.modeURL||(k.modeURL="../mode/%N/%N.js");var Q={};function G(C,M){var z=M;return function(){--z==0&&C()}}function R(C,M,z){var q=k.modes[C],Ue=q&&q.dependencies;if(!Ue)return M();for(var se=[],Se=0;Se<Ue.length;++Se)k.modes.hasOwnProperty(Ue[Se])||se.push(Ue[Se]);if(!se.length)return M();for(var ne=G(M,se.length),Se=0;Se<se.length;++Se)k.requireMode(se[Se],ne,z)}k.requireMode=function(C,M,z){if(typeof C!="string"&&(C=C.name),k.modes.hasOwnProperty(C))return R(C,M,z);if(Q.hasOwnProperty(C))return Q[C].push(M);var q=z&&z.path?z.path(C):k.modeURL.replace(/%N/g,C);if(z&&z.loadMode)z.loadMode(q,function(){R(C,M,z)});else if(j=="plain"){var Ue=document.createElement("script");Ue.src=q;var se=document.getElementsByTagName("script")[0],Se=Q[C]=[M];k.on(Ue,"load",function(){R(C,function(){for(var ne=0;ne<Se.length;++ne)Se[ne]()},z)}),se.parentNode.insertBefore(Ue,se)}else j=="cjs"?(require(q),M()):j=="amd"&&requirejs([q],M)},k.autoLoadMode=function(C,M,z){k.modes.hasOwnProperty(M)||k.requireMode(M,function(){C.setOption("mode",C.getOption("mode"))},z)}}),(function(k){typeof exports=="object"&&typeof module=="object"?k(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],k):k(CodeMirror)})(function(k){"use strict";k.overlayMode=function(j,Q,G){return{startState:function(){return{base:k.startState(j),overlay:k.startState(Q),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(R){return{base:k.copyState(j,R.base),overlay:k.copyState(Q,R.overlay),basePos:R.basePos,baseCur:null,overlayPos:R.overlayPos,overlayCur:null}},token:function(R,C){return(R!=C.streamSeen||Math.min(C.basePos,C.overlayPos)<R.start)&&(C.streamSeen=R,C.basePos=C.overlayPos=R.start),R.start==C.basePos&&(C.baseCur=j.token(R,C.base),C.basePos=R.pos),R.start==C.overlayPos&&(R.pos=R.start,C.overlayCur=Q.token(R,C.overlay),C.overlayPos=R.pos),R.pos=Math.min(C.basePos,C.overlayPos),C.overlayCur==null?C.baseCur:C.baseCur!=null&&C.overlay.combineTokens||G&&C.overlay.combineTokens==null?C.baseCur+" "+C.overlayCur:C.overlayCur},indent:j.indent&&function(R,C,M){return j.indent(R.base,C,M)},electricChars:j.electricChars,innerMode:function(R){return{state:R.base,mode:j}},blankLine:function(R){var C,M;return j.blankLine&&(C=j.blankLine(R.base)),Q.blankLine&&(M=Q.blankLine(R.overlay)),M==null?C:G&&C!=null?C+" "+M:M}}}});