@limetech/lime-elements 36.0.0-next.9 → 36.1.0-dev.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 (304) hide show
  1. package/dist/cjs/{checkbox.template-b6c6562c.js → checkbox.template-ac867c17.js} +1 -1
  2. package/dist/cjs/{dateFormatter-05d80b12.js → dateFormatter-d7a8d40d.js} +1 -1
  3. package/dist/cjs/{index-2a28697b.js → index-287e25e0.js} +424 -246
  4. package/dist/cjs/lime-elements.cjs.js +3 -3
  5. package/dist/cjs/limel-badge.cjs.entry.js +24 -3
  6. package/dist/cjs/limel-banner.cjs.entry.js +3 -1
  7. package/dist/cjs/limel-button-group.cjs.entry.js +3 -8
  8. package/dist/cjs/{limel-button.cjs.entry.js → limel-button_2.cjs.entry.js} +117 -21
  9. package/dist/cjs/limel-checkbox.cjs.entry.js +10 -26
  10. package/dist/cjs/limel-chip-set.cjs.entry.js +40 -63
  11. package/dist/cjs/limel-circular-progress.cjs.entry.js +10 -15
  12. package/dist/cjs/limel-code-editor.cjs.entry.js +1693 -86
  13. package/dist/cjs/limel-collapsible-section.cjs.entry.js +5 -6
  14. package/dist/cjs/limel-color-picker-palette.cjs.entry.js +5 -1
  15. package/dist/cjs/limel-color-picker.cjs.entry.js +8 -2
  16. package/dist/cjs/limel-config.cjs.entry.js +2 -1
  17. package/dist/cjs/limel-date-picker.cjs.entry.js +18 -36
  18. package/dist/cjs/limel-dialog.cjs.entry.js +3 -11
  19. package/dist/cjs/limel-dock-button.cjs.entry.js +30 -14
  20. package/dist/cjs/limel-dock.cjs.entry.js +12 -47
  21. package/dist/cjs/limel-file.cjs.entry.js +10 -24
  22. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +151 -50
  23. package/dist/cjs/limel-flex-container.cjs.entry.js +1 -13
  24. package/dist/cjs/limel-form.cjs.entry.js +327 -328
  25. package/dist/cjs/limel-grid.cjs.entry.js +1 -1
  26. package/dist/cjs/limel-header.cjs.entry.js +5 -1
  27. package/dist/cjs/limel-icon-button.cjs.entry.js +3 -8
  28. package/dist/cjs/limel-icon.cjs.entry.js +4 -1
  29. package/dist/cjs/limel-input-field.cjs.entry.js +40 -66
  30. package/dist/cjs/limel-linear-progress.cjs.entry.js +1 -7
  31. package/dist/cjs/limel-list_2.cjs.entry.js +9 -18
  32. package/dist/cjs/limel-menu-list.cjs.entry.js +8 -16
  33. package/dist/cjs/limel-picker.cjs.entry.js +14 -39
  34. package/dist/cjs/limel-popover_4.cjs.entry.js +14 -13
  35. package/dist/cjs/limel-portal.cjs.entry.js +63 -73
  36. package/dist/cjs/limel-progress-flow-item.cjs.entry.js +5 -14
  37. package/dist/cjs/limel-progress-flow.cjs.entry.js +4 -20
  38. package/dist/cjs/limel-select.cjs.entry.js +12 -30
  39. package/dist/cjs/limel-shortcut.cjs.entry.js +52 -0
  40. package/dist/cjs/limel-slider.cjs.entry.js +12 -33
  41. package/dist/cjs/limel-snackbar.cjs.entry.js +7 -5
  42. package/dist/cjs/limel-spinner.cjs.entry.js +1 -7
  43. package/dist/cjs/limel-split-button.cjs.entry.js +27 -0
  44. package/dist/cjs/limel-switch.cjs.entry.js +6 -19
  45. package/dist/cjs/limel-tab-bar.cjs.entry.js +2 -5
  46. package/dist/cjs/limel-tab-panel.cjs.entry.js +2 -5
  47. package/dist/cjs/limel-table.cjs.entry.js +33 -33
  48. package/dist/cjs/loader.cjs.js +3 -3
  49. package/dist/cjs/{moment-5cfac5cd.js → moment-d1e35cdc.js} +2 -2
  50. package/dist/cjs/{translations-5a8d7f6c.js → translations-ca7279bc.js} +6 -0
  51. package/dist/collection/collection-manifest.json +4 -2
  52. package/dist/collection/components/badge/badge.css +13 -0
  53. package/dist/collection/components/badge/badge.js +60 -28
  54. package/dist/collection/components/banner/banner.js +88 -83
  55. package/dist/collection/components/button/button.css +15 -8
  56. package/dist/collection/components/button/button.js +148 -160
  57. package/dist/collection/components/button-group/button-group.js +81 -79
  58. package/dist/collection/components/checkbox/checkbox.js +172 -176
  59. package/dist/collection/components/checkbox/checkbox.template.js +15 -23
  60. package/dist/collection/components/chip-set/chip-set.css +10 -2
  61. package/dist/collection/components/chip-set/chip-set.js +500 -534
  62. package/dist/collection/components/circular-progress/circular-progress.css +27 -5
  63. package/dist/collection/components/circular-progress/circular-progress.js +129 -113
  64. package/dist/collection/components/code-editor/code-editor.css +153 -1
  65. package/dist/collection/components/code-editor/code-editor.js +219 -135
  66. package/dist/collection/components/collapsible-section/collapsible-section.css +8 -7
  67. package/dist/collection/components/collapsible-section/collapsible-section.js +120 -124
  68. package/dist/collection/components/color-picker/color-picker-palette.js +102 -92
  69. package/dist/collection/components/color-picker/color-picker.js +143 -131
  70. package/dist/collection/components/config/config.js +21 -17
  71. package/dist/collection/components/date-picker/date-picker.js +255 -245
  72. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.css +595 -166
  73. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.js +150 -143
  74. package/dist/collection/components/date-picker/pickers/QuarterPicker.js +1 -3
  75. package/dist/collection/components/dialog/dialog.js +134 -142
  76. package/dist/collection/components/dock/dock-button/dock-button.css +15 -9
  77. package/dist/collection/components/dock/dock-button/dock-button.js +158 -124
  78. package/dist/collection/components/dock/dock.css +7 -3
  79. package/dist/collection/components/dock/dock.js +207 -205
  80. package/dist/collection/components/file/file.js +187 -191
  81. package/dist/collection/components/flex-container/flex-container.js +96 -102
  82. package/dist/collection/components/form/form.js +158 -150
  83. package/dist/collection/components/grid/grid.js +11 -7
  84. package/dist/collection/components/header/header.js +89 -87
  85. package/dist/collection/components/icon/icon.js +79 -66
  86. package/dist/collection/components/icon-button/icon-button.js +85 -85
  87. package/dist/collection/components/input-field/input-field.css +9 -8
  88. package/dist/collection/components/input-field/input-field.js +494 -510
  89. package/dist/collection/components/linear-progress/linear-progress.js +57 -61
  90. package/dist/collection/components/list/list-renderer.js +3 -12
  91. package/dist/collection/components/list/list.js +167 -164
  92. package/dist/collection/components/list/radio-button/radio-button.template.js +2 -8
  93. package/dist/collection/components/menu/menu.js +185 -208
  94. package/dist/collection/components/menu-list/menu-list-renderer.js +2 -9
  95. package/dist/collection/components/menu-list/menu-list.js +150 -167
  96. package/dist/collection/components/menu-surface/menu-surface.js +69 -64
  97. package/dist/collection/components/picker/picker.js +412 -427
  98. package/dist/collection/components/popover/popover.js +79 -74
  99. package/dist/collection/components/popover-surface/popover-surface.css +9 -4
  100. package/dist/collection/components/popover-surface/popover-surface.js +34 -25
  101. package/dist/collection/components/portal/portal.js +145 -158
  102. package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.css +21 -8
  103. package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.js +90 -94
  104. package/dist/collection/components/progress-flow/progress-flow.js +93 -101
  105. package/dist/collection/components/select/select.css +10 -11
  106. package/dist/collection/components/select/select.js +206 -211
  107. package/dist/collection/components/select/select.template.js +10 -25
  108. package/dist/collection/components/shortcut/shortcut.css +91 -0
  109. package/dist/collection/components/shortcut/shortcut.js +194 -0
  110. package/dist/collection/components/slider/slider.js +233 -264
  111. package/dist/collection/components/snackbar/snackbar.js +175 -169
  112. package/dist/collection/components/spinner/spinner.js +56 -85
  113. package/dist/collection/components/split-button/split-button.css +75 -0
  114. package/dist/collection/components/split-button/split-button.js +168 -0
  115. package/dist/collection/components/switch/switch.js +117 -129
  116. package/dist/collection/components/tab-bar/tab-bar.js +87 -92
  117. package/dist/collection/components/tab-panel/tab-panel.js +64 -61
  118. package/dist/collection/components/table/columns.js +1 -0
  119. package/dist/collection/components/table/layout.js +8 -0
  120. package/dist/collection/components/table/table.css +89 -61
  121. package/dist/collection/components/table/table.js +453 -432
  122. package/dist/collection/components/tooltip/tooltip-content.js +70 -61
  123. package/dist/collection/components/tooltip/tooltip.js +96 -91
  124. package/dist/collection/icons/angle_left.svg +593 -0
  125. package/dist/collection/icons/angle_right.svg +593 -0
  126. package/dist/collection/icons/external_link.svg +593 -0
  127. package/dist/collection/icons/high_importance.svg +593 -0
  128. package/dist/collection/icons/unit-test.svg +593 -0
  129. package/dist/collection/style/internal/codemirror-tooltip.scss +19 -0
  130. package/dist/collection/style/internal/z-index.scss +0 -7
  131. package/dist/collection/style/mixins.scss +11 -0
  132. package/dist/collection/translations/da.js +1 -0
  133. package/dist/collection/translations/en.js +1 -0
  134. package/dist/collection/translations/fi.js +1 -0
  135. package/dist/collection/translations/nl.js +1 -0
  136. package/dist/collection/translations/no.js +1 -0
  137. package/dist/collection/translations/sv.js +1 -0
  138. package/dist/esm/{checkbox.template-2f1bbc98.js → checkbox.template-fc7fcd06.js} +1 -1
  139. package/dist/esm/{dateFormatter-2cad0292.js → dateFormatter-784c3334.js} +1 -1
  140. package/dist/esm/{index-11cd0b60.js → index-cdfd351d.js} +424 -246
  141. package/dist/esm/lime-elements.js +3 -3
  142. package/dist/esm/limel-badge.entry.js +24 -3
  143. package/dist/esm/limel-banner.entry.js +3 -1
  144. package/dist/esm/limel-button-group.entry.js +3 -8
  145. package/dist/esm/{limel-button.entry.js → limel-button_2.entry.js} +117 -22
  146. package/dist/esm/limel-checkbox.entry.js +10 -26
  147. package/dist/esm/limel-chip-set.entry.js +40 -63
  148. package/dist/esm/limel-circular-progress.entry.js +10 -15
  149. package/dist/esm/limel-code-editor.entry.js +1693 -86
  150. package/dist/esm/limel-collapsible-section.entry.js +5 -6
  151. package/dist/esm/limel-color-picker-palette.entry.js +5 -1
  152. package/dist/esm/limel-color-picker.entry.js +8 -2
  153. package/dist/esm/limel-config.entry.js +2 -1
  154. package/dist/esm/limel-date-picker.entry.js +18 -36
  155. package/dist/esm/limel-dialog.entry.js +3 -11
  156. package/dist/esm/limel-dock-button.entry.js +30 -14
  157. package/dist/esm/limel-dock.entry.js +12 -47
  158. package/dist/esm/limel-file.entry.js +10 -24
  159. package/dist/esm/limel-flatpickr-adapter.entry.js +151 -50
  160. package/dist/esm/limel-flex-container.entry.js +1 -13
  161. package/dist/esm/limel-form.entry.js +327 -328
  162. package/dist/esm/limel-grid.entry.js +1 -1
  163. package/dist/esm/limel-header.entry.js +5 -1
  164. package/dist/esm/limel-icon-button.entry.js +3 -8
  165. package/dist/esm/limel-icon.entry.js +4 -1
  166. package/dist/esm/limel-input-field.entry.js +40 -66
  167. package/dist/esm/limel-linear-progress.entry.js +1 -7
  168. package/dist/esm/limel-list_2.entry.js +9 -18
  169. package/dist/esm/limel-menu-list.entry.js +8 -16
  170. package/dist/esm/limel-picker.entry.js +14 -39
  171. package/dist/esm/limel-popover_4.entry.js +14 -13
  172. package/dist/esm/limel-portal.entry.js +63 -73
  173. package/dist/esm/limel-progress-flow-item.entry.js +5 -14
  174. package/dist/esm/limel-progress-flow.entry.js +4 -20
  175. package/dist/esm/limel-select.entry.js +12 -30
  176. package/dist/esm/limel-shortcut.entry.js +48 -0
  177. package/dist/esm/limel-slider.entry.js +12 -33
  178. package/dist/esm/limel-snackbar.entry.js +7 -5
  179. package/dist/esm/limel-spinner.entry.js +1 -7
  180. package/dist/esm/limel-split-button.entry.js +23 -0
  181. package/dist/esm/limel-switch.entry.js +6 -19
  182. package/dist/esm/limel-tab-bar.entry.js +2 -5
  183. package/dist/esm/limel-tab-panel.entry.js +2 -5
  184. package/dist/esm/limel-table.entry.js +33 -33
  185. package/dist/esm/loader.js +3 -3
  186. package/dist/esm/{moment-367e51c5.js → moment-faa8a4a8.js} +2 -2
  187. package/dist/esm/polyfills/css-shim.js +1 -1
  188. package/dist/esm/{translations-682e905e.js → translations-0d0ee941.js} +6 -0
  189. package/dist/lime-elements/lime-elements.css +1 -1
  190. package/dist/lime-elements/lime-elements.esm.js +1 -1
  191. package/dist/lime-elements/p-059e0a64.entry.js +1 -0
  192. package/dist/lime-elements/{p-440454ed.entry.js → p-06f2f6b4.entry.js} +1 -1
  193. package/dist/lime-elements/{p-71efe2ca.entry.js → p-0dbde06f.entry.js} +1 -1
  194. package/dist/lime-elements/p-12a7453b.entry.js +73 -0
  195. package/dist/lime-elements/p-15c2eb16.entry.js +1 -0
  196. package/dist/lime-elements/{p-c80acfb2.entry.js → p-15ca0d70.entry.js} +4 -4
  197. package/dist/lime-elements/{p-ed65468d.entry.js → p-16eb9071.entry.js} +1 -1
  198. package/dist/lime-elements/{p-1ede893b.js → p-1af8258b.js} +1 -1
  199. package/dist/lime-elements/p-246862ec.js +1 -0
  200. package/dist/lime-elements/p-28dffd9e.entry.js +1 -0
  201. package/dist/lime-elements/p-334b5f82.entry.js +37 -0
  202. package/dist/lime-elements/p-36a3b897.entry.js +1 -0
  203. package/dist/lime-elements/p-4b426b7e.entry.js +11 -0
  204. package/dist/lime-elements/p-4eda8b67.entry.js +82 -0
  205. package/dist/lime-elements/{p-9af0704c.entry.js → p-4fb4e89b.entry.js} +1 -1
  206. package/dist/lime-elements/{p-a5af84a7.entry.js → p-5338663b.entry.js} +1 -1
  207. package/dist/lime-elements/p-5ce60a32.entry.js +126 -0
  208. package/dist/lime-elements/p-5f13035a.entry.js +1 -0
  209. package/dist/lime-elements/{p-42b67933.entry.js → p-600464a9.entry.js} +1 -1
  210. package/dist/lime-elements/p-6534e16a.entry.js +1 -0
  211. package/dist/lime-elements/p-6a4a5ddd.entry.js +1 -0
  212. package/dist/lime-elements/p-6c38b505.entry.js +1 -0
  213. package/dist/lime-elements/{p-d76f896d.js → p-73df4d83.js} +1 -1
  214. package/dist/lime-elements/p-744c21f8.entry.js +1 -0
  215. package/dist/lime-elements/p-75d01713.entry.js +1 -0
  216. package/dist/lime-elements/p-768b7cbb.entry.js +1 -0
  217. package/dist/lime-elements/{p-6e7809a6.entry.js → p-82cd7bb6.entry.js} +1 -1
  218. package/dist/lime-elements/p-84a137a7.entry.js +1 -0
  219. package/dist/lime-elements/p-8715eac0.entry.js +1 -0
  220. package/dist/lime-elements/{p-8827628d.entry.js → p-8fb83e83.entry.js} +2 -2
  221. package/dist/lime-elements/p-90961075.entry.js +1 -0
  222. package/dist/lime-elements/p-945afca2.js +3 -0
  223. package/dist/lime-elements/p-9984b31c.entry.js +1 -0
  224. package/dist/lime-elements/p-9bd76629.entry.js +59 -0
  225. package/dist/lime-elements/p-9f19e0c1.entry.js +1 -0
  226. package/dist/lime-elements/p-ace4e596.entry.js +1 -0
  227. package/dist/lime-elements/p-cad7cda1.entry.js +16 -0
  228. package/dist/lime-elements/p-cfaa685f.entry.js +1 -0
  229. package/dist/lime-elements/{p-94899019.entry.js → p-d1187867.entry.js} +1 -1
  230. package/dist/lime-elements/{p-aa66620a.entry.js → p-d3ebc657.entry.js} +2 -2
  231. package/dist/lime-elements/p-d4e788e1.js +2 -0
  232. package/dist/lime-elements/p-d512656b.entry.js +1 -0
  233. package/dist/lime-elements/p-d8e5a9ee.entry.js +1 -0
  234. package/dist/lime-elements/p-dcd2a664.entry.js +16 -0
  235. package/dist/lime-elements/p-de161bb5.entry.js +1 -0
  236. package/dist/lime-elements/p-e4bca82b.entry.js +1 -0
  237. package/dist/lime-elements/p-e7bb664f.entry.js +1 -0
  238. package/dist/lime-elements/p-ef04b849.entry.js +82 -0
  239. package/dist/lime-elements/style/internal/codemirror-tooltip.scss +19 -0
  240. package/dist/lime-elements/style/internal/z-index.scss +0 -7
  241. package/dist/lime-elements/style/mixins.scss +11 -0
  242. package/dist/loader/package.json +1 -0
  243. package/dist/types/components/badge/badge.d.ts +12 -4
  244. package/dist/types/components/chip-set/chip-set.d.ts +3 -2
  245. package/dist/types/components/circular-progress/circular-progress.d.ts +5 -0
  246. package/dist/types/components/code-editor/code-editor.d.ts +14 -0
  247. package/dist/types/components/date-picker/date-picker.d.ts +4 -0
  248. package/dist/types/components/dock/dock-button/dock-button.d.ts +21 -5
  249. package/dist/types/components/dock/dock.d.ts +11 -3
  250. package/dist/types/components/input-field/input-field.d.ts +6 -0
  251. package/dist/types/components/menu/menu.d.ts +1 -2
  252. package/dist/types/components/menu-list/menu-list.d.ts +2 -7
  253. package/dist/types/components/picker/picker.d.ts +2 -2
  254. package/dist/types/components/shortcut/shortcut.d.ts +57 -0
  255. package/dist/types/components/split-button/split-button.d.ts +45 -0
  256. package/dist/types/components/tab-bar/tab.types.d.ts +1 -1
  257. package/dist/types/components/table/layout.d.ts +2 -0
  258. package/dist/types/components/table/table.d.ts +16 -1
  259. package/dist/types/components/table/table.types.d.ts +4 -0
  260. package/dist/types/components.d.ts +390 -80
  261. package/dist/types/stencil-public-runtime.d.ts +20 -4
  262. package/dist/types/translations/da.d.ts +1 -0
  263. package/dist/types/translations/en.d.ts +1 -0
  264. package/dist/types/translations/fi.d.ts +1 -0
  265. package/dist/types/translations/nl.d.ts +1 -0
  266. package/dist/types/translations/no.d.ts +1 -0
  267. package/dist/types/translations/sv.d.ts +1 -0
  268. package/package.json +27 -26
  269. package/dist/cjs/limel-menu.cjs.entry.js +0 -148
  270. package/dist/esm/limel-menu.entry.js +0 -144
  271. package/dist/lime-elements/p-009de50e.entry.js +0 -1
  272. package/dist/lime-elements/p-19f72dab.entry.js +0 -1
  273. package/dist/lime-elements/p-1a2ffe75.entry.js +0 -82
  274. package/dist/lime-elements/p-1dfccbc5.entry.js +0 -1
  275. package/dist/lime-elements/p-1e59114e.entry.js +0 -1
  276. package/dist/lime-elements/p-2639edf9.entry.js +0 -73
  277. package/dist/lime-elements/p-3af5f9ad.js +0 -3
  278. package/dist/lime-elements/p-3bf54a4c.js +0 -1
  279. package/dist/lime-elements/p-53e01330.entry.js +0 -1
  280. package/dist/lime-elements/p-5ad60e14.entry.js +0 -126
  281. package/dist/lime-elements/p-63e25a0a.entry.js +0 -1
  282. package/dist/lime-elements/p-64f068a8.entry.js +0 -1
  283. package/dist/lime-elements/p-6884b012.entry.js +0 -1
  284. package/dist/lime-elements/p-6966b5df.entry.js +0 -1
  285. package/dist/lime-elements/p-6b1bc80f.entry.js +0 -1
  286. package/dist/lime-elements/p-722d32e0.entry.js +0 -1
  287. package/dist/lime-elements/p-75152d89.entry.js +0 -1
  288. package/dist/lime-elements/p-7e571ec6.entry.js +0 -11
  289. package/dist/lime-elements/p-7ee4b825.entry.js +0 -1
  290. package/dist/lime-elements/p-93cd2268.entry.js +0 -1
  291. package/dist/lime-elements/p-95f275ab.entry.js +0 -1
  292. package/dist/lime-elements/p-97d6c4a6.entry.js +0 -1
  293. package/dist/lime-elements/p-995bbd2a.entry.js +0 -1
  294. package/dist/lime-elements/p-a465084b.entry.js +0 -82
  295. package/dist/lime-elements/p-af0ec482.entry.js +0 -16
  296. package/dist/lime-elements/p-b0046fcd.entry.js +0 -1
  297. package/dist/lime-elements/p-b95e80c9.entry.js +0 -1
  298. package/dist/lime-elements/p-bd098a11.entry.js +0 -1
  299. package/dist/lime-elements/p-d1ee4501.entry.js +0 -37
  300. package/dist/lime-elements/p-d74fa89e.entry.js +0 -1
  301. package/dist/lime-elements/p-e98d76e8.entry.js +0 -59
  302. package/dist/lime-elements/p-e9a95b8f.js +0 -1
  303. package/dist/lime-elements/p-f0c9dadd.entry.js +0 -1
  304. package/dist/lime-elements/p-f0e872b6.entry.js +0 -16
@@ -1,11 +1,11 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index-11cd0b60.js';
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cdfd351d.js';
2
2
  import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-5ec8f9b7.js';
3
3
 
4
4
  var codemirror = createCommonjsModule(function (module, exports) {
5
5
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
6
- // Distributed under an MIT license: https://codemirror.net/LICENSE
6
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
7
7
 
8
- // This is CodeMirror (https://codemirror.net), a code editor
8
+ // This is CodeMirror (https://codemirror.net/5), a code editor
9
9
  // implemented in JavaScript on top of the browser's DOM.
10
10
  //
11
11
  // You can find some technical background for some of the code below
@@ -27,7 +27,8 @@ var codemirror = createCommonjsModule(function (module, exports) {
27
27
  var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
28
28
  var webkit = !edge && /WebKit\//.test(userAgent);
29
29
  var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
30
- var chrome = !edge && /Chrome\//.test(userAgent);
30
+ var chrome = !edge && /Chrome\/(\d+)/.exec(userAgent);
31
+ var chrome_version = chrome && +chrome[1];
31
32
  var presto = /Opera\//.test(userAgent);
32
33
  var safari = /Apple Computer/.test(navigator.vendor);
33
34
  var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
@@ -112,15 +113,15 @@ var codemirror = createCommonjsModule(function (module, exports) {
112
113
  } while (child = child.parentNode)
113
114
  }
114
115
 
115
- function activeElt() {
116
+ function activeElt(doc) {
116
117
  // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
117
118
  // IE < 10 will throw when accessed while the page is loading or in an iframe.
118
119
  // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
119
120
  var activeElement;
120
121
  try {
121
- activeElement = document.activeElement;
122
+ activeElement = doc.activeElement;
122
123
  } catch(e) {
123
- activeElement = document.body || null;
124
+ activeElement = doc.body || null;
124
125
  }
125
126
  while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
126
127
  { activeElement = activeElement.shadowRoot.activeElement; }
@@ -144,6 +145,10 @@ var codemirror = createCommonjsModule(function (module, exports) {
144
145
  else if (ie) // Suppress mysterious IE10 errors
145
146
  { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
146
147
 
148
+ function doc(cm) { return cm.display.wrapper.ownerDocument }
149
+
150
+ function win(cm) { return doc(cm).defaultView }
151
+
147
152
  function bind(f) {
148
153
  var args = Array.prototype.slice.call(arguments, 1);
149
154
  return function(){return f.apply(null, args)}
@@ -2573,16 +2578,16 @@ var codemirror = createCommonjsModule(function (module, exports) {
2573
2578
  cm.display.lineNumChars = null;
2574
2579
  }
2575
2580
 
2576
- function pageScrollX() {
2581
+ function pageScrollX(doc) {
2577
2582
  // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
2578
2583
  // which causes page_Offset and bounding client rects to use
2579
2584
  // different reference viewports and invalidate our calculations.
2580
- if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
2581
- return window.pageXOffset || (document.documentElement || document.body).scrollLeft
2585
+ if (chrome && android) { return -(doc.body.getBoundingClientRect().left - parseInt(getComputedStyle(doc.body).marginLeft)) }
2586
+ return doc.defaultView.pageXOffset || (doc.documentElement || doc.body).scrollLeft
2582
2587
  }
2583
- function pageScrollY() {
2584
- if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
2585
- return window.pageYOffset || (document.documentElement || document.body).scrollTop
2588
+ function pageScrollY(doc) {
2589
+ if (chrome && android) { return -(doc.body.getBoundingClientRect().top - parseInt(getComputedStyle(doc.body).marginTop)) }
2590
+ return doc.defaultView.pageYOffset || (doc.documentElement || doc.body).scrollTop
2586
2591
  }
2587
2592
 
2588
2593
  function widgetTopHeight(lineObj) {
@@ -2610,8 +2615,8 @@ var codemirror = createCommonjsModule(function (module, exports) {
2610
2615
  else { yOff -= cm.display.viewOffset; }
2611
2616
  if (context == "page" || context == "window") {
2612
2617
  var lOff = cm.display.lineSpace.getBoundingClientRect();
2613
- yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
2614
- var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
2618
+ yOff += lOff.top + (context == "window" ? 0 : pageScrollY(doc(cm)));
2619
+ var xOff = lOff.left + (context == "window" ? 0 : pageScrollX(doc(cm)));
2615
2620
  rect.left += xOff; rect.right += xOff;
2616
2621
  }
2617
2622
  rect.top += yOff; rect.bottom += yOff;
@@ -2625,8 +2630,8 @@ var codemirror = createCommonjsModule(function (module, exports) {
2625
2630
  var left = coords.left, top = coords.top;
2626
2631
  // First move into "page" coordinate system
2627
2632
  if (context == "page") {
2628
- left -= pageScrollX();
2629
- top -= pageScrollY();
2633
+ left -= pageScrollX(doc(cm));
2634
+ top -= pageScrollY(doc(cm));
2630
2635
  } else if (context == "local" || !context) {
2631
2636
  var localBox = cm.display.sizer.getBoundingClientRect();
2632
2637
  left += localBox.left;
@@ -3442,8 +3447,9 @@ var codemirror = createCommonjsModule(function (module, exports) {
3442
3447
  if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
3443
3448
 
3444
3449
  var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
3450
+ var doc = display.wrapper.ownerDocument;
3445
3451
  if (rect.top + box.top < 0) { doScroll = true; }
3446
- else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
3452
+ else if (rect.bottom + box.top > (doc.defaultView.innerHeight || doc.documentElement.clientHeight)) { doScroll = false; }
3447
3453
  if (doScroll != null && !phantom) {
3448
3454
  var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
3449
3455
  cm.display.lineSpace.appendChild(scrollNode);
@@ -3697,13 +3703,13 @@ var codemirror = createCommonjsModule(function (module, exports) {
3697
3703
  NativeScrollbars.prototype.zeroWidthHack = function () {
3698
3704
  var w = mac && !mac_geMountainLion ? "12px" : "18px";
3699
3705
  this.horiz.style.height = this.vert.style.width = w;
3700
- this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
3706
+ this.horiz.style.visibility = this.vert.style.visibility = "hidden";
3701
3707
  this.disableHoriz = new Delayed;
3702
3708
  this.disableVert = new Delayed;
3703
3709
  };
3704
3710
 
3705
3711
  NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
3706
- bar.style.pointerEvents = "auto";
3712
+ bar.style.visibility = "";
3707
3713
  function maybeDisable() {
3708
3714
  // To find out whether the scrollbar is still visible, we
3709
3715
  // check whether the element under the pixel in the bottom
@@ -3714,7 +3720,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
3714
3720
  var box = bar.getBoundingClientRect();
3715
3721
  var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
3716
3722
  : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
3717
- if (elt != bar) { bar.style.pointerEvents = "none"; }
3723
+ if (elt != bar) { bar.style.visibility = "hidden"; }
3718
3724
  else { delay.set(1000, maybeDisable); }
3719
3725
  }
3720
3726
  delay.set(1000, maybeDisable);
@@ -3895,7 +3901,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
3895
3901
  cm.display.maxLineChanged = false;
3896
3902
  }
3897
3903
 
3898
- var takeFocus = op.focus && op.focus == activeElt();
3904
+ var takeFocus = op.focus && op.focus == activeElt(doc(cm));
3899
3905
  if (op.preparedSelection)
3900
3906
  { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
3901
3907
  if (op.updatedDisplay || op.startHeight != cm.doc.height)
@@ -4072,11 +4078,11 @@ var codemirror = createCommonjsModule(function (module, exports) {
4072
4078
 
4073
4079
  function selectionSnapshot(cm) {
4074
4080
  if (cm.hasFocus()) { return null }
4075
- var active = activeElt();
4081
+ var active = activeElt(doc(cm));
4076
4082
  if (!active || !contains(cm.display.lineDiv, active)) { return null }
4077
4083
  var result = {activeElt: active};
4078
4084
  if (window.getSelection) {
4079
- var sel = window.getSelection();
4085
+ var sel = win(cm).getSelection();
4080
4086
  if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
4081
4087
  result.anchorNode = sel.anchorNode;
4082
4088
  result.anchorOffset = sel.anchorOffset;
@@ -4088,11 +4094,12 @@ var codemirror = createCommonjsModule(function (module, exports) {
4088
4094
  }
4089
4095
 
4090
4096
  function restoreSelection(snapshot) {
4091
- if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
4097
+ if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt(snapshot.activeElt.ownerDocument)) { return }
4092
4098
  snapshot.activeElt.focus();
4093
4099
  if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
4094
4100
  snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
4095
- var sel = window.getSelection(), range = document.createRange();
4101
+ var doc = snapshot.activeElt.ownerDocument;
4102
+ var sel = doc.defaultView.getSelection(), range = doc.createRange();
4096
4103
  range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
4097
4104
  range.collapse(false);
4098
4105
  sel.removeAllRanges();
@@ -4409,6 +4416,8 @@ var codemirror = createCommonjsModule(function (module, exports) {
4409
4416
  d.scroller.setAttribute("tabIndex", "-1");
4410
4417
  // The element in which the editor lives.
4411
4418
  d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
4419
+ // See #6982. FIXME remove when this has been fixed for a while in Chrome
4420
+ if (chrome && chrome_version >= 105) { d.wrapper.style.clipPath = "inset(0px)"; }
4412
4421
 
4413
4422
  // This attribute is respected by automatic translation systems such as Google Translate,
4414
4423
  // and may also be respected by tools used by human translators.
@@ -4510,6 +4519,17 @@ var codemirror = createCommonjsModule(function (module, exports) {
4510
4519
  }
4511
4520
 
4512
4521
  function onScrollWheel(cm, e) {
4522
+ // On Chrome 102, viewport updates somehow stop wheel-based
4523
+ // scrolling. Turning off pointer events during the scroll seems
4524
+ // to avoid the issue.
4525
+ if (chrome && chrome_version == 102) {
4526
+ if (cm.display.chromeScrollHack == null) { cm.display.sizer.style.pointerEvents = "none"; }
4527
+ else { clearTimeout(cm.display.chromeScrollHack); }
4528
+ cm.display.chromeScrollHack = setTimeout(function () {
4529
+ cm.display.chromeScrollHack = null;
4530
+ cm.display.sizer.style.pointerEvents = "";
4531
+ }, 100);
4532
+ }
4513
4533
  var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
4514
4534
  var pixelsPerUnit = wheelPixelsPerUnit;
4515
4535
  if (e.deltaMode === 0) {
@@ -5193,7 +5213,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
5193
5213
  var range = sel.ranges[i];
5194
5214
  var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
5195
5215
  var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
5196
- var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
5216
+ var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);
5197
5217
  if (out || newAnchor != range.anchor || newHead != range.head) {
5198
5218
  if (!out) { out = sel.ranges.slice(0, i); }
5199
5219
  out[i] = new Range(newAnchor, newHead);
@@ -7245,7 +7265,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
7245
7265
  function onKeyDown(e) {
7246
7266
  var cm = this;
7247
7267
  if (e.target && e.target != cm.display.input.getField()) { return }
7248
- cm.curOp.focus = activeElt();
7268
+ cm.curOp.focus = activeElt(doc(cm));
7249
7269
  if (signalDOMEvent(cm, e)) { return }
7250
7270
  // IE does strange things with escape.
7251
7271
  if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
@@ -7352,7 +7372,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
7352
7372
  }
7353
7373
  if (clickInGutter(cm, e)) { return }
7354
7374
  var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single";
7355
- window.focus();
7375
+ win(cm).focus();
7356
7376
 
7357
7377
  // #3261: make sure, that we're not starting a second selection
7358
7378
  if (button == 1 && cm.state.selectingText)
@@ -7407,7 +7427,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
7407
7427
 
7408
7428
  function leftButtonDown(cm, pos, repeat, event) {
7409
7429
  if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
7410
- else { cm.curOp.focus = activeElt(); }
7430
+ else { cm.curOp.focus = activeElt(doc(cm)); }
7411
7431
 
7412
7432
  var behavior = configureMouse(cm, repeat, event);
7413
7433
 
@@ -7477,19 +7497,19 @@ var codemirror = createCommonjsModule(function (module, exports) {
7477
7497
  // Normal selection, as opposed to text dragging.
7478
7498
  function leftButtonSelect(cm, event, start, behavior) {
7479
7499
  if (ie) { delayBlurEvent(cm); }
7480
- var display = cm.display, doc = cm.doc;
7500
+ var display = cm.display, doc$1 = cm.doc;
7481
7501
  e_preventDefault(event);
7482
7502
 
7483
- var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
7503
+ var ourRange, ourIndex, startSel = doc$1.sel, ranges = startSel.ranges;
7484
7504
  if (behavior.addNew && !behavior.extend) {
7485
- ourIndex = doc.sel.contains(start);
7505
+ ourIndex = doc$1.sel.contains(start);
7486
7506
  if (ourIndex > -1)
7487
7507
  { ourRange = ranges[ourIndex]; }
7488
7508
  else
7489
7509
  { ourRange = new Range(start, start); }
7490
7510
  } else {
7491
- ourRange = doc.sel.primary();
7492
- ourIndex = doc.sel.primIndex;
7511
+ ourRange = doc$1.sel.primary();
7512
+ ourIndex = doc$1.sel.primIndex;
7493
7513
  }
7494
7514
 
7495
7515
  if (behavior.unit == "rectangle") {
@@ -7506,18 +7526,18 @@ var codemirror = createCommonjsModule(function (module, exports) {
7506
7526
 
7507
7527
  if (!behavior.addNew) {
7508
7528
  ourIndex = 0;
7509
- setSelection(doc, new Selection([ourRange], 0), sel_mouse);
7510
- startSel = doc.sel;
7529
+ setSelection(doc$1, new Selection([ourRange], 0), sel_mouse);
7530
+ startSel = doc$1.sel;
7511
7531
  } else if (ourIndex == -1) {
7512
7532
  ourIndex = ranges.length;
7513
- setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
7533
+ setSelection(doc$1, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
7514
7534
  {scroll: false, origin: "*mouse"});
7515
7535
  } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
7516
- setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
7536
+ setSelection(doc$1, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
7517
7537
  {scroll: false, origin: "*mouse"});
7518
- startSel = doc.sel;
7538
+ startSel = doc$1.sel;
7519
7539
  } else {
7520
- replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
7540
+ replaceOneSelection(doc$1, ourIndex, ourRange, sel_mouse);
7521
7541
  }
7522
7542
 
7523
7543
  var lastPos = start;
@@ -7527,19 +7547,19 @@ var codemirror = createCommonjsModule(function (module, exports) {
7527
7547
 
7528
7548
  if (behavior.unit == "rectangle") {
7529
7549
  var ranges = [], tabSize = cm.options.tabSize;
7530
- var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
7531
- var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
7550
+ var startCol = countColumn(getLine(doc$1, start.line).text, start.ch, tabSize);
7551
+ var posCol = countColumn(getLine(doc$1, pos.line).text, pos.ch, tabSize);
7532
7552
  var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
7533
7553
  for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
7534
7554
  line <= end; line++) {
7535
- var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
7555
+ var text = getLine(doc$1, line).text, leftPos = findColumn(text, left, tabSize);
7536
7556
  if (left == right)
7537
7557
  { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
7538
7558
  else if (text.length > leftPos)
7539
7559
  { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
7540
7560
  }
7541
7561
  if (!ranges.length) { ranges.push(new Range(start, start)); }
7542
- setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
7562
+ setSelection(doc$1, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
7543
7563
  {origin: "*mouse", scroll: false});
7544
7564
  cm.scrollIntoView(pos);
7545
7565
  } else {
@@ -7554,8 +7574,8 @@ var codemirror = createCommonjsModule(function (module, exports) {
7554
7574
  anchor = maxPos(oldRange.to(), range.head);
7555
7575
  }
7556
7576
  var ranges$1 = startSel.ranges.slice(0);
7557
- ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
7558
- setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
7577
+ ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc$1, anchor), head));
7578
+ setSelection(doc$1, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
7559
7579
  }
7560
7580
  }
7561
7581
 
@@ -7571,9 +7591,9 @@ var codemirror = createCommonjsModule(function (module, exports) {
7571
7591
  var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle");
7572
7592
  if (!cur) { return }
7573
7593
  if (cmp(cur, lastPos) != 0) {
7574
- cm.curOp.focus = activeElt();
7594
+ cm.curOp.focus = activeElt(doc(cm));
7575
7595
  extendTo(cur);
7576
- var visible = visibleLines(display, doc);
7596
+ var visible = visibleLines(display, doc$1);
7577
7597
  if (cur.line >= visible.to || cur.line < visible.from)
7578
7598
  { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
7579
7599
  } else {
@@ -7598,7 +7618,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
7598
7618
  }
7599
7619
  off(display.wrapper.ownerDocument, "mousemove", move);
7600
7620
  off(display.wrapper.ownerDocument, "mouseup", up);
7601
- doc.history.lastSelOrigin = null;
7621
+ doc$1.history.lastSelOrigin = null;
7602
7622
  }
7603
7623
 
7604
7624
  var move = operation(cm, function (e) {
@@ -7755,7 +7775,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
7755
7775
  for (var i = newBreaks.length - 1; i >= 0; i--)
7756
7776
  { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
7757
7777
  });
7758
- option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) {
7778
+ option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g, function (cm, val, old) {
7759
7779
  cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
7760
7780
  if (old != Init) { cm.refresh(); }
7761
7781
  });
@@ -8198,7 +8218,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
8198
8218
  var pasted = e.clipboardData && e.clipboardData.getData("Text");
8199
8219
  if (pasted) {
8200
8220
  e.preventDefault();
8201
- if (!cm.isReadOnly() && !cm.options.disableInput)
8221
+ if (!cm.isReadOnly() && !cm.options.disableInput && cm.hasFocus())
8202
8222
  { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
8203
8223
  return true
8204
8224
  }
@@ -8275,7 +8295,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
8275
8295
 
8276
8296
  CodeMirror.prototype = {
8277
8297
  constructor: CodeMirror,
8278
- focus: function(){window.focus(); this.display.input.focus();},
8298
+ focus: function(){win(this).focus(); this.display.input.focus();},
8279
8299
 
8280
8300
  setOption: function(option, value) {
8281
8301
  var options = this.options, old = options[option];
@@ -8599,7 +8619,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
8599
8619
 
8600
8620
  signal(this, "overwriteToggle", this, this.state.overwrite);
8601
8621
  },
8602
- hasFocus: function() { return this.display.input.getField() == activeElt() },
8622
+ hasFocus: function() { return this.display.input.getField() == activeElt(doc(this)) },
8603
8623
  isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
8604
8624
 
8605
8625
  scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),
@@ -8780,7 +8800,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
8780
8800
  function findPosV(cm, pos, dir, unit) {
8781
8801
  var doc = cm.doc, x = pos.left, y;
8782
8802
  if (unit == "page") {
8783
- var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
8803
+ var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);
8784
8804
  var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
8785
8805
  y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
8786
8806
 
@@ -8880,7 +8900,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
8880
8900
  var kludge = hiddenTextarea(), te = kludge.firstChild;
8881
8901
  cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
8882
8902
  te.value = lastCopied.text.join("\n");
8883
- var hadFocus = activeElt();
8903
+ var hadFocus = activeElt(div.ownerDocument);
8884
8904
  selectInput(te);
8885
8905
  setTimeout(function () {
8886
8906
  cm.display.lineSpace.removeChild(kludge);
@@ -8903,7 +8923,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
8903
8923
 
8904
8924
  ContentEditableInput.prototype.prepareSelection = function () {
8905
8925
  var result = prepareSelection(this.cm, false);
8906
- result.focus = activeElt() == this.div;
8926
+ result.focus = activeElt(this.div.ownerDocument) == this.div;
8907
8927
  return result
8908
8928
  };
8909
8929
 
@@ -8999,7 +9019,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
8999
9019
 
9000
9020
  ContentEditableInput.prototype.focus = function () {
9001
9021
  if (this.cm.options.readOnly != "nocursor") {
9002
- if (!this.selectionInEditor() || activeElt() != this.div)
9022
+ if (!this.selectionInEditor() || activeElt(this.div.ownerDocument) != this.div)
9003
9023
  { this.showSelection(this.prepareSelection(), true); }
9004
9024
  this.div.focus();
9005
9025
  }
@@ -9351,6 +9371,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
9351
9371
  // Used to work around IE issue with selection being forgotten when focus moves away from textarea
9352
9372
  this.hasSelection = false;
9353
9373
  this.composing = null;
9374
+ this.resetting = false;
9354
9375
  };
9355
9376
 
9356
9377
  TextareaInput.prototype.init = function (display) {
@@ -9483,8 +9504,9 @@ var codemirror = createCommonjsModule(function (module, exports) {
9483
9504
  // Reset the input to correspond to the selection (or to be empty,
9484
9505
  // when not typing and nothing is selected)
9485
9506
  TextareaInput.prototype.reset = function (typing) {
9486
- if (this.contextMenuPending || this.composing) { return }
9507
+ if (this.contextMenuPending || this.composing && typing) { return }
9487
9508
  var cm = this.cm;
9509
+ this.resetting = true;
9488
9510
  if (cm.somethingSelected()) {
9489
9511
  this.prevInput = "";
9490
9512
  var content = cm.getSelection();
@@ -9495,6 +9517,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
9495
9517
  this.prevInput = this.textarea.value = "";
9496
9518
  if (ie && ie_version >= 9) { this.hasSelection = null; }
9497
9519
  }
9520
+ this.resetting = false;
9498
9521
  };
9499
9522
 
9500
9523
  TextareaInput.prototype.getField = function () { return this.textarea };
@@ -9502,7 +9525,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
9502
9525
  TextareaInput.prototype.supportsTouch = function () { return false };
9503
9526
 
9504
9527
  TextareaInput.prototype.focus = function () {
9505
- if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
9528
+ if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt(this.textarea.ownerDocument) != this.textarea)) {
9506
9529
  try { this.textarea.focus(); }
9507
9530
  catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
9508
9531
  }
@@ -9556,7 +9579,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
9556
9579
  // possible when it is clear that nothing happened. hasSelection
9557
9580
  // will be the case when there is a lot of text in the textarea,
9558
9581
  // in which case reading its value would be expensive.
9559
- if (this.contextMenuPending || !cm.state.focused ||
9582
+ if (this.contextMenuPending || this.resetting || !cm.state.focused ||
9560
9583
  (hasSelection(input) && !prevInput && !this.composing) ||
9561
9584
  cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
9562
9585
  { return false }
@@ -9625,9 +9648,9 @@ var codemirror = createCommonjsModule(function (module, exports) {
9625
9648
  input.wrapper.style.cssText = "position: static";
9626
9649
  te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
9627
9650
  var oldScrollY;
9628
- if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
9651
+ if (webkit) { oldScrollY = te.ownerDocument.defaultView.scrollY; } // Work around Chrome issue (#2712)
9629
9652
  display.input.focus();
9630
- if (webkit) { window.scrollTo(null, oldScrollY); }
9653
+ if (webkit) { te.ownerDocument.defaultView.scrollTo(null, oldScrollY); }
9631
9654
  display.input.reset();
9632
9655
  // Adds "Select all" to context menu in FF
9633
9656
  if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
@@ -9709,7 +9732,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
9709
9732
  // Set autofocus to true if this textarea is focused, or if it has
9710
9733
  // autofocus and no other element is focused.
9711
9734
  if (options.autofocus == null) {
9712
- var hasFocus = activeElt();
9735
+ var hasFocus = activeElt(textarea.ownerDocument);
9713
9736
  options.autofocus = hasFocus == textarea ||
9714
9737
  textarea.getAttribute("autofocus") != null && hasFocus == document.body;
9715
9738
  }
@@ -9843,7 +9866,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
9843
9866
 
9844
9867
  addLegacyProps(CodeMirror);
9845
9868
 
9846
- CodeMirror.version = "5.65.3";
9869
+ CodeMirror.version = "5.65.9";
9847
9870
 
9848
9871
  return CodeMirror;
9849
9872
 
@@ -9852,7 +9875,7 @@ var codemirror = createCommonjsModule(function (module, exports) {
9852
9875
 
9853
9876
  createCommonjsModule(function (module, exports) {
9854
9877
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
9855
- // Distributed under an MIT license: https://codemirror.net/LICENSE
9878
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
9856
9879
 
9857
9880
  (function(mod) {
9858
9881
  mod(codemirror);
@@ -10808,7 +10831,7 @@ CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript
10808
10831
 
10809
10832
  createCommonjsModule(function (module, exports) {
10810
10833
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
10811
- // Distributed under an MIT license: https://codemirror.net/LICENSE
10834
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
10812
10835
 
10813
10836
  (function(mod) {
10814
10837
  mod(codemirror);
@@ -10877,7 +10900,7 @@ createCommonjsModule(function (module, exports) {
10877
10900
 
10878
10901
  createCommonjsModule(function (module, exports) {
10879
10902
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
10880
- // Distributed under an MIT license: https://codemirror.net/LICENSE
10903
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
10881
10904
 
10882
10905
  (function(mod) {
10883
10906
  mod(codemirror);
@@ -11033,28 +11056,1567 @@ createCommonjsModule(function (module, exports) {
11033
11056
  });
11034
11057
  });
11035
11058
 
11036
- const codeEditorCss = ".CodeMirror{font-family:monospace;height:300px;color:black;direction:ltr}.CodeMirror-lines{padding:4px 0;}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px;}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white;}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:black}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid black;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0 !important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:transparent}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:transparent}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{0%{}50%{background-color:transparent}100%{}}@-webkit-keyframes blink{0%{}50%{background-color:transparent}100%{}}@keyframes blink{0%{}50%{background-color:transparent}100%{}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3,.cm-s-default .cm-type{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:#f00}.cm-invalidchar{color:#f00}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255, 150, 0, .3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:white}.CodeMirror-scroll{overflow:scroll !important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:none;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none;outline:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:none !important;border:none !important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px;}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:0.1px;}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:none}.CodeMirror-scroll,.CodeMirror-sizer,.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255, 255, 0, .4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:none}:host{display:flex;font-size:1rem}.editor{width:100%}.editor.is-light-mode{--code-editor-neutral-text-color:var(--contrast-1100);--code-editor-background-color:var(--contrast-200);--code-editor-gutter-background-color:var(--contrast-300);--code-editor-line-number-text-color:var(--contrast-700);--code-editor-cursor-color:var(--color-amber-dark);--code-editor-selection-highlight-color:var(--color-cyan-default);--code-editor-selection-lowlight-color:var(--contrast-600)}.editor.is-light-mode .cm-attribute,.editor.is-light-mode .cm-property,.editor.is-light-mode .cm-keyword{color:rgb(var(--color-violet-light))}.editor.is-light-mode .cm-operator{color:rgb(var(--color-sky-dark))}.editor.is-light-mode .cm-variable{color:rgb(var(--color-pink-light))}.editor.is-light-mode .cm-variable-2{color:rgb(var(--contrast-1100))}.editor.is-light-mode .cm-variable-3,.editor.is-light-mode .cm-type{color:rgb(var(--color-amber-darker))}.editor.is-light-mode .cm-builtin,.editor.is-light-mode .cm-meta{color:rgb(var(--color-amber-default))}.editor.is-light-mode .cm-atom{color:rgb(var(--color-coral-default))}.editor.is-light-mode .cm-tag,.editor.is-light-mode .cm-number{color:rgb(var(--color-magenta-default))}.editor.is-light-mode .cm-def{color:rgb(var(--color-sky-default))}.editor.is-light-mode .cm-string{color:rgb(var(--color-green-dark))}.editor.is-light-mode .cm-string-2{color:rgb(var(--color-pink-default))}.editor.is-light-mode .cm-qualifier{color:rgb(var(--color-grass-default))}.editor.is-light-mode .cm-error{color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}.editor.is-light-mode .cm-comment{color:rgba(var(--code-editor-neutral-text-color), 0.7)}.editor.is-dark-mode{--code-editor-neutral-text-color:var(--contrast-200);--code-editor-background-color:var(--contrast-1600);--code-editor-gutter-background-color:var(--contrast-1500);--code-editor-line-number-text-color:var(--contrast-1000);--code-editor-cursor-color:var(--color-amber-default);--code-editor-selection-highlight-color:var(--color-cyan-light);--code-editor-selection-lowlight-color:var(--contrast-1700)}.editor.is-dark-mode .cm-attribute,.editor.is-dark-mode .cm-property,.editor.is-dark-mode .cm-keyword{color:rgb(var(--color-purple-lighter))}.editor.is-dark-mode .cm-operator{color:rgb(var(--color-sky-lighter))}.editor.is-dark-mode .cm-variable{color:rgb(var(--color-pink-light))}.editor.is-dark-mode .cm-variable-2{color:rgb(var(--contrast-300))}.editor.is-dark-mode .cm-variable-3,.editor.is-dark-mode .cm-type{color:rgb(var(--color-yellow-light))}.editor.is-dark-mode .cm-builtin,.editor.is-dark-mode .cm-meta{color:rgb(var(--color-amber-default))}.editor.is-dark-mode .cm-atom{color:rgb(var(--color-coral-light))}.editor.is-dark-mode .cm-tag,.editor.is-dark-mode .cm-number{color:rgb(var(--color-magenta-light))}.editor.is-dark-mode .cm-def{color:rgb(var(--color-sky-light))}.editor.is-dark-mode .cm-string{color:rgb(var(--color-lime-light))}.editor.is-dark-mode .cm-string-2{color:rgb(var(--color-pink-lighter))}.editor.is-dark-mode .cm-qualifier{color:rgb(var(--color-grass-light))}.editor.is-dark-mode .cm-error{color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}.editor.is-dark-mode .cm-comment{color:rgba(var(--code-editor-neutral-text-color), 0.4)}.editor.readonly .CodeMirror-focused .CodeMirror-cursors{visibility:visible !important}.cm-s-lime.CodeMirror{color:rgb(var(--code-editor-neutral-text-color));background-color:rgb(var(--code-editor-background-color));border-radius:0.25rem;height:auto}.cm-s-lime .CodeMirror-scroll{max-height:var(--code-editor-max-height, 10rem)}.cm-s-lime.CodeMirror-focused div.CodeMirror-selected{background:rgba(var(--code-editor-selection-highlight-color), 0.15)}.cm-s-lime div.CodeMirror-selected{background:rgba(var(--code-editor-selection-highlight-color), 0.05)}.cm-s-lime .CodeMirror-gutters{background-color:rgb(var(--code-editor-gutter-background-color));color:rgb(var(--code-editor-line-number-text-color));border:none}.cm-s-lime .CodeMirror-guttermarker,.cm-s-lime .CodeMirror-guttermarker-subtle,.cm-s-lime .CodeMirror-linenumber{color:rgb(var(--code-editor-line-number-text-color))}.cm-s-lime .CodeMirror-cursor{border-left:1px solid rgb(var(--code-editor-cursor-color))}.editor.readonly .cm-s-lime .CodeMirror-cursor{border-color:rgba(var(--code-editor-neutral-text-color), 0.5);border-width:0.125rem}.cm-s-lime .CodeMirror-activeline-background{background:rgba(var(--code-editor-selection-lowlight-color), 0.5)}.cm-s-lime .CodeMirror-matchingbracket{font-weight:bold;color:rgb(var(--code-editor-neutral-text-color)) !important;background:rgba(var(--code-editor-selection-highlight-color), 0.15);position:relative}.cm-s-lime .CodeMirror-matchingbracket:before{content:\"_\";color:rgb(var(--code-editor-selection-highlight-color), 0.8);position:absolute;bottom:-0.4rem;left:0;right:0}";
11059
+ createCommonjsModule(function (module, exports) {
11060
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
11061
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
11062
+
11063
+ (function(mod) {
11064
+ mod(codemirror);
11065
+ })(function(CodeMirror) {
11066
+ var GUTTER_ID = "CodeMirror-lint-markers";
11067
+ var LINT_LINE_ID = "CodeMirror-lint-line-";
11068
+
11069
+ function showTooltip(cm, e, content) {
11070
+ var tt = document.createElement("div");
11071
+ tt.className = "CodeMirror-lint-tooltip cm-s-" + cm.options.theme;
11072
+ tt.appendChild(content.cloneNode(true));
11073
+ if (cm.state.lint.options.selfContain)
11074
+ cm.getWrapperElement().appendChild(tt);
11075
+ else
11076
+ document.body.appendChild(tt);
11077
+
11078
+ function position(e) {
11079
+ if (!tt.parentNode) return CodeMirror.off(document, "mousemove", position);
11080
+ tt.style.top = Math.max(0, e.clientY - tt.offsetHeight - 5) + "px";
11081
+ tt.style.left = (e.clientX + 5) + "px";
11082
+ }
11083
+ CodeMirror.on(document, "mousemove", position);
11084
+ position(e);
11085
+ if (tt.style.opacity != null) tt.style.opacity = 1;
11086
+ return tt;
11087
+ }
11088
+ function rm(elt) {
11089
+ if (elt.parentNode) elt.parentNode.removeChild(elt);
11090
+ }
11091
+ function hideTooltip(tt) {
11092
+ if (!tt.parentNode) return;
11093
+ if (tt.style.opacity == null) rm(tt);
11094
+ tt.style.opacity = 0;
11095
+ setTimeout(function() { rm(tt); }, 600);
11096
+ }
11097
+
11098
+ function showTooltipFor(cm, e, content, node) {
11099
+ var tooltip = showTooltip(cm, e, content);
11100
+ function hide() {
11101
+ CodeMirror.off(node, "mouseout", hide);
11102
+ if (tooltip) { hideTooltip(tooltip); tooltip = null; }
11103
+ }
11104
+ var poll = setInterval(function() {
11105
+ if (tooltip) for (var n = node;; n = n.parentNode) {
11106
+ if (n && n.nodeType == 11) n = n.host;
11107
+ if (n == document.body) return;
11108
+ if (!n) { hide(); break; }
11109
+ }
11110
+ if (!tooltip) return clearInterval(poll);
11111
+ }, 400);
11112
+ CodeMirror.on(node, "mouseout", hide);
11113
+ }
11114
+
11115
+ function LintState(cm, conf, hasGutter) {
11116
+ this.marked = [];
11117
+ if (conf instanceof Function) conf = {getAnnotations: conf};
11118
+ if (!conf || conf === true) conf = {};
11119
+ this.options = {};
11120
+ this.linterOptions = conf.options || {};
11121
+ for (var prop in defaults) this.options[prop] = defaults[prop];
11122
+ for (var prop in conf) {
11123
+ if (defaults.hasOwnProperty(prop)) {
11124
+ if (conf[prop] != null) this.options[prop] = conf[prop];
11125
+ } else if (!conf.options) {
11126
+ this.linterOptions[prop] = conf[prop];
11127
+ }
11128
+ }
11129
+ this.timeout = null;
11130
+ this.hasGutter = hasGutter;
11131
+ this.onMouseOver = function(e) { onMouseOver(cm, e); };
11132
+ this.waitingFor = 0;
11133
+ }
11134
+
11135
+ var defaults = {
11136
+ highlightLines: false,
11137
+ tooltips: true,
11138
+ delay: 500,
11139
+ lintOnChange: true,
11140
+ getAnnotations: null,
11141
+ async: false,
11142
+ selfContain: null,
11143
+ formatAnnotation: null,
11144
+ onUpdateLinting: null
11145
+ };
11146
+
11147
+ function clearMarks(cm) {
11148
+ var state = cm.state.lint;
11149
+ if (state.hasGutter) cm.clearGutter(GUTTER_ID);
11150
+ if (state.options.highlightLines) clearErrorLines(cm);
11151
+ for (var i = 0; i < state.marked.length; ++i)
11152
+ state.marked[i].clear();
11153
+ state.marked.length = 0;
11154
+ }
11155
+
11156
+ function clearErrorLines(cm) {
11157
+ cm.eachLine(function(line) {
11158
+ var has = line.wrapClass && /\bCodeMirror-lint-line-\w+\b/.exec(line.wrapClass);
11159
+ if (has) cm.removeLineClass(line, "wrap", has[0]);
11160
+ });
11161
+ }
11162
+
11163
+ function makeMarker(cm, labels, severity, multiple, tooltips) {
11164
+ var marker = document.createElement("div"), inner = marker;
11165
+ marker.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + severity;
11166
+ if (multiple) {
11167
+ inner = marker.appendChild(document.createElement("div"));
11168
+ inner.className = "CodeMirror-lint-marker CodeMirror-lint-marker-multiple";
11169
+ }
11170
+
11171
+ if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) {
11172
+ showTooltipFor(cm, e, labels, inner);
11173
+ });
11174
+
11175
+ return marker;
11176
+ }
11177
+
11178
+ function getMaxSeverity(a, b) {
11179
+ if (a == "error") return a;
11180
+ else return b;
11181
+ }
11182
+
11183
+ function groupByLine(annotations) {
11184
+ var lines = [];
11185
+ for (var i = 0; i < annotations.length; ++i) {
11186
+ var ann = annotations[i], line = ann.from.line;
11187
+ (lines[line] || (lines[line] = [])).push(ann);
11188
+ }
11189
+ return lines;
11190
+ }
11191
+
11192
+ function annotationTooltip(ann) {
11193
+ var severity = ann.severity;
11194
+ if (!severity) severity = "error";
11195
+ var tip = document.createElement("div");
11196
+ tip.className = "CodeMirror-lint-message CodeMirror-lint-message-" + severity;
11197
+ if (typeof ann.messageHTML != 'undefined') {
11198
+ tip.innerHTML = ann.messageHTML;
11199
+ } else {
11200
+ tip.appendChild(document.createTextNode(ann.message));
11201
+ }
11202
+ return tip;
11203
+ }
11204
+
11205
+ function lintAsync(cm, getAnnotations) {
11206
+ var state = cm.state.lint;
11207
+ var id = ++state.waitingFor;
11208
+ function abort() {
11209
+ id = -1;
11210
+ cm.off("change", abort);
11211
+ }
11212
+ cm.on("change", abort);
11213
+ getAnnotations(cm.getValue(), function(annotations, arg2) {
11214
+ cm.off("change", abort);
11215
+ if (state.waitingFor != id) return
11216
+ if (arg2 && annotations instanceof CodeMirror) annotations = arg2;
11217
+ cm.operation(function() {updateLinting(cm, annotations);});
11218
+ }, state.linterOptions, cm);
11219
+ }
11220
+
11221
+ function startLinting(cm) {
11222
+ var state = cm.state.lint;
11223
+ if (!state) return;
11224
+ var options = state.options;
11225
+ /*
11226
+ * Passing rules in `options` property prevents JSHint (and other linters) from complaining
11227
+ * about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc.
11228
+ */
11229
+ var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
11230
+ if (!getAnnotations) return;
11231
+ if (options.async || getAnnotations.async) {
11232
+ lintAsync(cm, getAnnotations);
11233
+ } else {
11234
+ var annotations = getAnnotations(cm.getValue(), state.linterOptions, cm);
11235
+ if (!annotations) return;
11236
+ if (annotations.then) annotations.then(function(issues) {
11237
+ cm.operation(function() {updateLinting(cm, issues);});
11238
+ });
11239
+ else cm.operation(function() {updateLinting(cm, annotations);});
11240
+ }
11241
+ }
11242
+
11243
+ function updateLinting(cm, annotationsNotSorted) {
11244
+ var state = cm.state.lint;
11245
+ if (!state) return;
11246
+ var options = state.options;
11247
+ clearMarks(cm);
11248
+
11249
+ var annotations = groupByLine(annotationsNotSorted);
11250
+
11251
+ for (var line = 0; line < annotations.length; ++line) {
11252
+ var anns = annotations[line];
11253
+ if (!anns) continue;
11254
+
11255
+ // filter out duplicate messages
11256
+ var message = [];
11257
+ anns = anns.filter(function(item) { return message.indexOf(item.message) > -1 ? false : message.push(item.message) });
11258
+
11259
+ var maxSeverity = null;
11260
+ var tipLabel = state.hasGutter && document.createDocumentFragment();
11261
+
11262
+ for (var i = 0; i < anns.length; ++i) {
11263
+ var ann = anns[i];
11264
+ var severity = ann.severity;
11265
+ if (!severity) severity = "error";
11266
+ maxSeverity = getMaxSeverity(maxSeverity, severity);
11267
+
11268
+ if (options.formatAnnotation) ann = options.formatAnnotation(ann);
11269
+ if (state.hasGutter) tipLabel.appendChild(annotationTooltip(ann));
11270
+
11271
+ if (ann.to) state.marked.push(cm.markText(ann.from, ann.to, {
11272
+ className: "CodeMirror-lint-mark CodeMirror-lint-mark-" + severity,
11273
+ __annotation: ann
11274
+ }));
11275
+ }
11276
+ // use original annotations[line] to show multiple messages
11277
+ if (state.hasGutter)
11278
+ cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, annotations[line].length > 1,
11279
+ options.tooltips));
11280
+
11281
+ if (options.highlightLines)
11282
+ cm.addLineClass(line, "wrap", LINT_LINE_ID + maxSeverity);
11283
+ }
11284
+ if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm);
11285
+ }
11286
+
11287
+ function onChange(cm) {
11288
+ var state = cm.state.lint;
11289
+ if (!state) return;
11290
+ clearTimeout(state.timeout);
11291
+ state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay);
11292
+ }
11293
+
11294
+ function popupTooltips(cm, annotations, e) {
11295
+ var target = e.target || e.srcElement;
11296
+ var tooltip = document.createDocumentFragment();
11297
+ for (var i = 0; i < annotations.length; i++) {
11298
+ var ann = annotations[i];
11299
+ tooltip.appendChild(annotationTooltip(ann));
11300
+ }
11301
+ showTooltipFor(cm, e, tooltip, target);
11302
+ }
11303
+
11304
+ function onMouseOver(cm, e) {
11305
+ var target = e.target || e.srcElement;
11306
+ if (!/\bCodeMirror-lint-mark-/.test(target.className)) return;
11307
+ var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2;
11308
+ var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client"));
11309
+
11310
+ var annotations = [];
11311
+ for (var i = 0; i < spans.length; ++i) {
11312
+ var ann = spans[i].__annotation;
11313
+ if (ann) annotations.push(ann);
11314
+ }
11315
+ if (annotations.length) popupTooltips(cm, annotations, e);
11316
+ }
11317
+
11318
+ CodeMirror.defineOption("lint", false, function(cm, val, old) {
11319
+ if (old && old != CodeMirror.Init) {
11320
+ clearMarks(cm);
11321
+ if (cm.state.lint.options.lintOnChange !== false)
11322
+ cm.off("change", onChange);
11323
+ CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver);
11324
+ clearTimeout(cm.state.lint.timeout);
11325
+ delete cm.state.lint;
11326
+ }
11327
+
11328
+ if (val) {
11329
+ var gutters = cm.getOption("gutters"), hasLintGutter = false;
11330
+ for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true;
11331
+ var state = cm.state.lint = new LintState(cm, val, hasLintGutter);
11332
+ if (state.options.lintOnChange)
11333
+ cm.on("change", onChange);
11334
+ if (state.options.tooltips != false && state.options.tooltips != "gutter")
11335
+ CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver);
11336
+
11337
+ startLinting(cm);
11338
+ }
11339
+ });
11340
+
11341
+ CodeMirror.defineExtension("performLint", function() {
11342
+ startLinting(this);
11343
+ });
11344
+ });
11345
+ });
11346
+
11347
+ createCommonjsModule(function (module, exports) {
11348
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
11349
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
11350
+
11351
+ // Depends on jsonlint.js from https://github.com/zaach/jsonlint
11352
+
11353
+ // declare global: jsonlint
11354
+
11355
+ (function(mod) {
11356
+ mod(codemirror);
11357
+ })(function(CodeMirror) {
11358
+
11359
+ CodeMirror.registerHelper("lint", "json", function(text) {
11360
+ var found = [];
11361
+ if (!window.jsonlint) {
11362
+ if (window.console) {
11363
+ window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run.");
11364
+ }
11365
+ return found;
11366
+ }
11367
+ // for jsonlint's web dist jsonlint is exported as an object with a single property parser, of which parseError
11368
+ // is a subproperty
11369
+ var jsonlint = window.jsonlint.parser || window.jsonlint;
11370
+ jsonlint.parseError = function(str, hash) {
11371
+ var loc = hash.loc;
11372
+ found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
11373
+ to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
11374
+ message: str});
11375
+ };
11376
+ try { jsonlint.parse(text); }
11377
+ catch(e) {}
11378
+ return found;
11379
+ });
11380
+
11381
+ });
11382
+ });
11383
+
11384
+ var foldcode = createCommonjsModule(function (module, exports) {
11385
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
11386
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
11387
+
11388
+ (function(mod) {
11389
+ mod(codemirror);
11390
+ })(function(CodeMirror) {
11391
+
11392
+ function doFold(cm, pos, options, force) {
11393
+ if (options && options.call) {
11394
+ var finder = options;
11395
+ options = null;
11396
+ } else {
11397
+ var finder = getOption(cm, options, "rangeFinder");
11398
+ }
11399
+ if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
11400
+ var minSize = getOption(cm, options, "minFoldSize");
11401
+
11402
+ function getRange(allowFolded) {
11403
+ var range = finder(cm, pos);
11404
+ if (!range || range.to.line - range.from.line < minSize) return null;
11405
+ if (force === "fold") return range;
11406
+
11407
+ var marks = cm.findMarksAt(range.from);
11408
+ for (var i = 0; i < marks.length; ++i) {
11409
+ if (marks[i].__isFold) {
11410
+ if (!allowFolded) return null;
11411
+ range.cleared = true;
11412
+ marks[i].clear();
11413
+ }
11414
+ }
11415
+ return range;
11416
+ }
11417
+
11418
+ var range = getRange(true);
11419
+ if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) {
11420
+ pos = CodeMirror.Pos(pos.line - 1, 0);
11421
+ range = getRange(false);
11422
+ }
11423
+ if (!range || range.cleared || force === "unfold") return;
11424
+
11425
+ var myWidget = makeWidget(cm, options, range);
11426
+ CodeMirror.on(myWidget, "mousedown", function(e) {
11427
+ myRange.clear();
11428
+ CodeMirror.e_preventDefault(e);
11429
+ });
11430
+ var myRange = cm.markText(range.from, range.to, {
11431
+ replacedWith: myWidget,
11432
+ clearOnEnter: getOption(cm, options, "clearOnEnter"),
11433
+ __isFold: true
11434
+ });
11435
+ myRange.on("clear", function(from, to) {
11436
+ CodeMirror.signal(cm, "unfold", cm, from, to);
11437
+ });
11438
+ CodeMirror.signal(cm, "fold", cm, range.from, range.to);
11439
+ }
11440
+
11441
+ function makeWidget(cm, options, range) {
11442
+ var widget = getOption(cm, options, "widget");
11443
+
11444
+ if (typeof widget == "function") {
11445
+ widget = widget(range.from, range.to);
11446
+ }
11447
+
11448
+ if (typeof widget == "string") {
11449
+ var text = document.createTextNode(widget);
11450
+ widget = document.createElement("span");
11451
+ widget.appendChild(text);
11452
+ widget.className = "CodeMirror-foldmarker";
11453
+ } else if (widget) {
11454
+ widget = widget.cloneNode(true);
11455
+ }
11456
+ return widget;
11457
+ }
11458
+
11459
+ // Clumsy backwards-compatible interface
11460
+ CodeMirror.newFoldFunction = function(rangeFinder, widget) {
11461
+ return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); };
11462
+ };
11463
+
11464
+ // New-style interface
11465
+ CodeMirror.defineExtension("foldCode", function(pos, options, force) {
11466
+ doFold(this, pos, options, force);
11467
+ });
11468
+
11469
+ CodeMirror.defineExtension("isFolded", function(pos) {
11470
+ var marks = this.findMarksAt(pos);
11471
+ for (var i = 0; i < marks.length; ++i)
11472
+ if (marks[i].__isFold) return true;
11473
+ });
11474
+
11475
+ CodeMirror.commands.toggleFold = function(cm) {
11476
+ cm.foldCode(cm.getCursor());
11477
+ };
11478
+ CodeMirror.commands.fold = function(cm) {
11479
+ cm.foldCode(cm.getCursor(), null, "fold");
11480
+ };
11481
+ CodeMirror.commands.unfold = function(cm) {
11482
+ cm.foldCode(cm.getCursor(), { scanUp: false }, "unfold");
11483
+ };
11484
+ CodeMirror.commands.foldAll = function(cm) {
11485
+ cm.operation(function() {
11486
+ for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
11487
+ cm.foldCode(CodeMirror.Pos(i, 0), { scanUp: false }, "fold");
11488
+ });
11489
+ };
11490
+ CodeMirror.commands.unfoldAll = function(cm) {
11491
+ cm.operation(function() {
11492
+ for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
11493
+ cm.foldCode(CodeMirror.Pos(i, 0), { scanUp: false }, "unfold");
11494
+ });
11495
+ };
11496
+
11497
+ CodeMirror.registerHelper("fold", "combine", function() {
11498
+ var funcs = Array.prototype.slice.call(arguments, 0);
11499
+ return function(cm, start) {
11500
+ for (var i = 0; i < funcs.length; ++i) {
11501
+ var found = funcs[i](cm, start);
11502
+ if (found) return found;
11503
+ }
11504
+ };
11505
+ });
11506
+
11507
+ CodeMirror.registerHelper("fold", "auto", function(cm, start) {
11508
+ var helpers = cm.getHelpers(start, "fold");
11509
+ for (var i = 0; i < helpers.length; i++) {
11510
+ var cur = helpers[i](cm, start);
11511
+ if (cur) return cur;
11512
+ }
11513
+ });
11514
+
11515
+ var defaultOptions = {
11516
+ rangeFinder: CodeMirror.fold.auto,
11517
+ widget: "\u2194",
11518
+ minFoldSize: 0,
11519
+ scanUp: false,
11520
+ clearOnEnter: true
11521
+ };
11522
+
11523
+ CodeMirror.defineOption("foldOptions", null);
11524
+
11525
+ function getOption(cm, options, name) {
11526
+ if (options && options[name] !== undefined)
11527
+ return options[name];
11528
+ var editorOptions = cm.options.foldOptions;
11529
+ if (editorOptions && editorOptions[name] !== undefined)
11530
+ return editorOptions[name];
11531
+ return defaultOptions[name];
11532
+ }
11533
+
11534
+ CodeMirror.defineExtension("foldOption", function(options, name) {
11535
+ return getOption(this, options, name);
11536
+ });
11537
+ });
11538
+ });
11539
+
11540
+ createCommonjsModule(function (module, exports) {
11541
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
11542
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
11543
+
11544
+ (function(mod) {
11545
+ mod(codemirror, foldcode);
11546
+ })(function(CodeMirror) {
11547
+
11548
+ CodeMirror.defineOption("foldGutter", false, function(cm, val, old) {
11549
+ if (old && old != CodeMirror.Init) {
11550
+ cm.clearGutter(cm.state.foldGutter.options.gutter);
11551
+ cm.state.foldGutter = null;
11552
+ cm.off("gutterClick", onGutterClick);
11553
+ cm.off("changes", onChange);
11554
+ cm.off("viewportChange", onViewportChange);
11555
+ cm.off("fold", onFold);
11556
+ cm.off("unfold", onFold);
11557
+ cm.off("swapDoc", onChange);
11558
+ cm.off("optionChange", optionChange);
11559
+ }
11560
+ if (val) {
11561
+ cm.state.foldGutter = new State(parseOptions(val));
11562
+ updateInViewport(cm);
11563
+ cm.on("gutterClick", onGutterClick);
11564
+ cm.on("changes", onChange);
11565
+ cm.on("viewportChange", onViewportChange);
11566
+ cm.on("fold", onFold);
11567
+ cm.on("unfold", onFold);
11568
+ cm.on("swapDoc", onChange);
11569
+ cm.on("optionChange", optionChange);
11570
+ }
11571
+ });
11572
+
11573
+ var Pos = CodeMirror.Pos;
11574
+
11575
+ function State(options) {
11576
+ this.options = options;
11577
+ this.from = this.to = 0;
11578
+ }
11579
+
11580
+ function parseOptions(opts) {
11581
+ if (opts === true) opts = {};
11582
+ if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter";
11583
+ if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open";
11584
+ if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded";
11585
+ return opts;
11586
+ }
11587
+
11588
+ function isFolded(cm, line) {
11589
+ var marks = cm.findMarks(Pos(line, 0), Pos(line + 1, 0));
11590
+ for (var i = 0; i < marks.length; ++i) {
11591
+ if (marks[i].__isFold) {
11592
+ var fromPos = marks[i].find(-1);
11593
+ if (fromPos && fromPos.line === line)
11594
+ return marks[i];
11595
+ }
11596
+ }
11597
+ }
11598
+
11599
+ function marker(spec) {
11600
+ if (typeof spec == "string") {
11601
+ var elt = document.createElement("div");
11602
+ elt.className = spec + " CodeMirror-guttermarker-subtle";
11603
+ return elt;
11604
+ } else {
11605
+ return spec.cloneNode(true);
11606
+ }
11607
+ }
11608
+
11609
+ function updateFoldInfo(cm, from, to) {
11610
+ var opts = cm.state.foldGutter.options, cur = from - 1;
11611
+ var minSize = cm.foldOption(opts, "minFoldSize");
11612
+ var func = cm.foldOption(opts, "rangeFinder");
11613
+ // we can reuse the built-in indicator element if its className matches the new state
11614
+ var clsFolded = typeof opts.indicatorFolded == "string" && classTest(opts.indicatorFolded);
11615
+ var clsOpen = typeof opts.indicatorOpen == "string" && classTest(opts.indicatorOpen);
11616
+ cm.eachLine(from, to, function(line) {
11617
+ ++cur;
11618
+ var mark = null;
11619
+ var old = line.gutterMarkers;
11620
+ if (old) old = old[opts.gutter];
11621
+ if (isFolded(cm, cur)) {
11622
+ if (clsFolded && old && clsFolded.test(old.className)) return;
11623
+ mark = marker(opts.indicatorFolded);
11624
+ } else {
11625
+ var pos = Pos(cur, 0);
11626
+ var range = func && func(cm, pos);
11627
+ if (range && range.to.line - range.from.line >= minSize) {
11628
+ if (clsOpen && old && clsOpen.test(old.className)) return;
11629
+ mark = marker(opts.indicatorOpen);
11630
+ }
11631
+ }
11632
+ if (!mark && !old) return;
11633
+ cm.setGutterMarker(line, opts.gutter, mark);
11634
+ });
11635
+ }
11636
+
11637
+ // copied from CodeMirror/src/util/dom.js
11638
+ function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
11639
+
11640
+ function updateInViewport(cm) {
11641
+ var vp = cm.getViewport(), state = cm.state.foldGutter;
11642
+ if (!state) return;
11643
+ cm.operation(function() {
11644
+ updateFoldInfo(cm, vp.from, vp.to);
11645
+ });
11646
+ state.from = vp.from; state.to = vp.to;
11647
+ }
11648
+
11649
+ function onGutterClick(cm, line, gutter) {
11650
+ var state = cm.state.foldGutter;
11651
+ if (!state) return;
11652
+ var opts = state.options;
11653
+ if (gutter != opts.gutter) return;
11654
+ var folded = isFolded(cm, line);
11655
+ if (folded) folded.clear();
11656
+ else cm.foldCode(Pos(line, 0), opts);
11657
+ }
11658
+
11659
+ function optionChange(cm, option) {
11660
+ if (option == "mode") onChange(cm);
11661
+ }
11662
+
11663
+ function onChange(cm) {
11664
+ var state = cm.state.foldGutter;
11665
+ if (!state) return;
11666
+ var opts = state.options;
11667
+ state.from = state.to = 0;
11668
+ clearTimeout(state.changeUpdate);
11669
+ state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);
11670
+ }
11671
+
11672
+ function onViewportChange(cm) {
11673
+ var state = cm.state.foldGutter;
11674
+ if (!state) return;
11675
+ var opts = state.options;
11676
+ clearTimeout(state.changeUpdate);
11677
+ state.changeUpdate = setTimeout(function() {
11678
+ var vp = cm.getViewport();
11679
+ if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
11680
+ updateInViewport(cm);
11681
+ } else {
11682
+ cm.operation(function() {
11683
+ if (vp.from < state.from) {
11684
+ updateFoldInfo(cm, vp.from, state.from);
11685
+ state.from = vp.from;
11686
+ }
11687
+ if (vp.to > state.to) {
11688
+ updateFoldInfo(cm, state.to, vp.to);
11689
+ state.to = vp.to;
11690
+ }
11691
+ });
11692
+ }
11693
+ }, opts.updateViewportTimeSpan || 400);
11694
+ }
11695
+
11696
+ function onFold(cm, from) {
11697
+ var state = cm.state.foldGutter;
11698
+ if (!state) return;
11699
+ var line = from.line;
11700
+ if (line >= state.from && line < state.to)
11701
+ updateFoldInfo(cm, line, line + 1);
11702
+ }
11703
+ });
11704
+ });
11705
+
11706
+ createCommonjsModule(function (module, exports) {
11707
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
11708
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
11709
+
11710
+ (function(mod) {
11711
+ mod(codemirror);
11712
+ })(function(CodeMirror) {
11713
+
11714
+ function bracketFolding(pairs) {
11715
+ return function(cm, start) {
11716
+ var line = start.line, lineText = cm.getLine(line);
11717
+
11718
+ function findOpening(pair) {
11719
+ var tokenType;
11720
+ for (var at = start.ch, pass = 0;;) {
11721
+ var found = at <= 0 ? -1 : lineText.lastIndexOf(pair[0], at - 1);
11722
+ if (found == -1) {
11723
+ if (pass == 1) break;
11724
+ pass = 1;
11725
+ at = lineText.length;
11726
+ continue;
11727
+ }
11728
+ if (pass == 1 && found < start.ch) break;
11729
+ tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
11730
+ if (!/^(comment|string)/.test(tokenType)) return {ch: found + 1, tokenType: tokenType, pair: pair};
11731
+ at = found - 1;
11732
+ }
11733
+ }
11734
+
11735
+ function findRange(found) {
11736
+ var count = 1, lastLine = cm.lastLine(), end, startCh = found.ch, endCh;
11737
+ outer: for (var i = line; i <= lastLine; ++i) {
11738
+ var text = cm.getLine(i), pos = i == line ? startCh : 0;
11739
+ for (;;) {
11740
+ var nextOpen = text.indexOf(found.pair[0], pos), nextClose = text.indexOf(found.pair[1], pos);
11741
+ if (nextOpen < 0) nextOpen = text.length;
11742
+ if (nextClose < 0) nextClose = text.length;
11743
+ pos = Math.min(nextOpen, nextClose);
11744
+ if (pos == text.length) break;
11745
+ if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == found.tokenType) {
11746
+ if (pos == nextOpen) ++count;
11747
+ else if (!--count) { end = i; endCh = pos; break outer; }
11748
+ }
11749
+ ++pos;
11750
+ }
11751
+ }
11752
+
11753
+ if (end == null || line == end) return null
11754
+ return {from: CodeMirror.Pos(line, startCh),
11755
+ to: CodeMirror.Pos(end, endCh)};
11756
+ }
11757
+
11758
+ var found = [];
11759
+ for (var i = 0; i < pairs.length; i++) {
11760
+ var open = findOpening(pairs[i]);
11761
+ if (open) found.push(open);
11762
+ }
11763
+ found.sort(function(a, b) { return a.ch - b.ch });
11764
+ for (var i = 0; i < found.length; i++) {
11765
+ var range = findRange(found[i]);
11766
+ if (range) return range
11767
+ }
11768
+ return null
11769
+ }
11770
+ }
11771
+
11772
+ CodeMirror.registerHelper("fold", "brace", bracketFolding([["{", "}"], ["[", "]"]]));
11773
+
11774
+ CodeMirror.registerHelper("fold", "brace-paren", bracketFolding([["{", "}"], ["[", "]"], ["(", ")"]]));
11775
+
11776
+ CodeMirror.registerHelper("fold", "import", function(cm, start) {
11777
+ function hasImport(line) {
11778
+ if (line < cm.firstLine() || line > cm.lastLine()) return null;
11779
+ var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
11780
+ if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
11781
+ if (start.type != "keyword" || start.string != "import") return null;
11782
+ // Now find closing semicolon, return its position
11783
+ for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) {
11784
+ var text = cm.getLine(i), semi = text.indexOf(";");
11785
+ if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)};
11786
+ }
11787
+ }
11788
+
11789
+ var startLine = start.line, has = hasImport(startLine), prev;
11790
+ if (!has || hasImport(startLine - 1) || ((prev = hasImport(startLine - 2)) && prev.end.line == startLine - 1))
11791
+ return null;
11792
+ for (var end = has.end;;) {
11793
+ var next = hasImport(end.line + 1);
11794
+ if (next == null) break;
11795
+ end = next.end;
11796
+ }
11797
+ return {from: cm.clipPos(CodeMirror.Pos(startLine, has.startCh + 1)), to: end};
11798
+ });
11799
+
11800
+ CodeMirror.registerHelper("fold", "include", function(cm, start) {
11801
+ function hasInclude(line) {
11802
+ if (line < cm.firstLine() || line > cm.lastLine()) return null;
11803
+ var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
11804
+ if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
11805
+ if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8;
11806
+ }
11807
+
11808
+ var startLine = start.line, has = hasInclude(startLine);
11809
+ if (has == null || hasInclude(startLine - 1) != null) return null;
11810
+ for (var end = startLine;;) {
11811
+ var next = hasInclude(end + 1);
11812
+ if (next == null) break;
11813
+ ++end;
11814
+ }
11815
+ return {from: CodeMirror.Pos(startLine, has + 1),
11816
+ to: cm.clipPos(CodeMirror.Pos(end))};
11817
+ });
11818
+
11819
+ });
11820
+ });
11821
+
11822
+ var jsonlint_1 = createCommonjsModule(function (module) {
11823
+ var jsonlint = (function(){var require=true,module=false;var exports={};/*
11824
+ json_parse.js
11825
+ 2016-05-02
11826
+
11827
+ Public Domain.
11828
+
11829
+ NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
11830
+
11831
+ This file creates a json_parse function.
11832
+
11833
+ json_parse(text, reviver)
11834
+ This method parses a JSON text to produce an object or array.
11835
+ It can throw a SyntaxError exception.
11836
+
11837
+ The optional reviver parameter is a function that can filter and
11838
+ transform the results. It receives each of the keys and values,
11839
+ and its return value is used instead of the original value.
11840
+ If it returns what it received, then the structure is not modified.
11841
+ If it returns undefined then the member is deleted.
11842
+
11843
+ Example:
11844
+
11845
+ // Parse the text. Values that look like ISO date strings will
11846
+ // be converted to Date objects.
11847
+
11848
+ myData = json_parse(text, function (key, value) {
11849
+ var a;
11850
+ if (typeof value === "string") {
11851
+ a =
11852
+ /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
11853
+ if (a) {
11854
+ return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
11855
+ +a[5], +a[6]));
11856
+ }
11857
+ }
11858
+ return value;
11859
+ });
11860
+
11861
+ This is a reference implementation. You are free to copy, modify, or
11862
+ redistribute.
11863
+
11864
+ This code should be minified before deployment.
11865
+ See http://javascript.crockford.com/jsmin.html
11866
+
11867
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
11868
+ NOT CONTROL.
11869
+ */
11870
+
11871
+ /*jslint for */
11872
+
11873
+ /*property
11874
+ at, b, call, charAt, f, fromCharCode, hasOwnProperty, message, n, name,
11875
+ prototype, push, r, t, text
11876
+ */
11877
+
11878
+ var ___dougJSONParse = (function () {
11879
+
11880
+ // This is a function that can parse a JSON text, producing a JavaScript
11881
+ // data structure. It is a simple, recursive descent parser. It does not use
11882
+ // eval or regular expressions, so it can be used as a model for implementing
11883
+ // a JSON parser in other languages.
11884
+
11885
+ // We are defining the function inside of another function to avoid creating
11886
+ // global variables.
11887
+
11888
+ var at; // The index of the current character
11889
+ var ch; // The current character
11890
+ var escapee = {
11891
+ "\"": "\"",
11892
+ "\\": "\\",
11893
+ "/": "/",
11894
+ b: "\b",
11895
+ f: "\f",
11896
+ n: "\n",
11897
+ r: "\r",
11898
+ t: "\t"
11899
+ };
11900
+ var text;
11901
+
11902
+ var error = function (m) {
11903
+
11904
+ // Call error when something is wrong.
11905
+
11906
+ throw {
11907
+ name: "SyntaxError",
11908
+ message: m,
11909
+ at: at,
11910
+ text: text
11911
+ };
11912
+ };
11913
+
11914
+ var next = function (c) {
11915
+
11916
+ // If a c parameter is provided, verify that it matches the current character.
11917
+
11918
+ if (c && c !== ch) {
11919
+ error("Expected '" + c + "' instead of '" + ch + "'");
11920
+ }
11921
+
11922
+ // Get the next character. When there are no more characters,
11923
+ // return the empty string.
11924
+
11925
+ ch = text.charAt(at);
11926
+ at += 1;
11927
+ return ch;
11928
+ };
11929
+
11930
+ var number = function () {
11931
+
11932
+ // Parse a number value.
11933
+
11934
+ var value;
11935
+ var string = "";
11936
+
11937
+ if (ch === "-") {
11938
+ string = "-";
11939
+ next("-");
11940
+ }
11941
+ while (ch >= "0" && ch <= "9") {
11942
+ string += ch;
11943
+ next();
11944
+ }
11945
+ if (ch === ".") {
11946
+ string += ".";
11947
+ while (next() && ch >= "0" && ch <= "9") {
11948
+ string += ch;
11949
+ }
11950
+ }
11951
+ if (ch === "e" || ch === "E") {
11952
+ string += ch;
11953
+ next();
11954
+ if (ch === "-" || ch === "+") {
11955
+ string += ch;
11956
+ next();
11957
+ }
11958
+ while (ch >= "0" && ch <= "9") {
11959
+ string += ch;
11960
+ next();
11961
+ }
11962
+ }
11963
+ value = +string;
11964
+ if (!isFinite(value)) {
11965
+ error("Bad number");
11966
+ } else {
11967
+ return value;
11968
+ }
11969
+ };
11970
+
11971
+ var string = function () {
11972
+
11973
+ // Parse a string value.
11974
+
11975
+ var hex;
11976
+ var i;
11977
+ var value = "";
11978
+ var uffff;
11979
+
11980
+ // When parsing for string values, we must look for " and \ characters.
11981
+
11982
+ if (ch === "\"") {
11983
+ while (next()) {
11984
+ if (ch === "\"") {
11985
+ next();
11986
+ return value;
11987
+ }
11988
+ if (ch === "\\") {
11989
+ next();
11990
+ if (ch === "u") {
11991
+ uffff = 0;
11992
+ for (i = 0; i < 4; i += 1) {
11993
+ hex = parseInt(next(), 16);
11994
+ if (!isFinite(hex)) {
11995
+ break;
11996
+ }
11997
+ uffff = uffff * 16 + hex;
11998
+ }
11999
+ value += String.fromCharCode(uffff);
12000
+ } else if (typeof escapee[ch] === "string") {
12001
+ value += escapee[ch];
12002
+ } else {
12003
+ break;
12004
+ }
12005
+ } else {
12006
+ value += ch;
12007
+ }
12008
+ }
12009
+ }
12010
+ error("Bad string");
12011
+ };
12012
+
12013
+ var white = function () {
12014
+
12015
+ // Skip whitespace.
12016
+
12017
+ while (ch && ch <= " ") {
12018
+ next();
12019
+ }
12020
+ };
12021
+
12022
+ var word = function () {
12023
+
12024
+ // true, false, or null.
12025
+
12026
+ switch (ch) {
12027
+ case "t":
12028
+ next("t");
12029
+ next("r");
12030
+ next("u");
12031
+ next("e");
12032
+ return true;
12033
+ case "f":
12034
+ next("f");
12035
+ next("a");
12036
+ next("l");
12037
+ next("s");
12038
+ next("e");
12039
+ return false;
12040
+ case "n":
12041
+ next("n");
12042
+ next("u");
12043
+ next("l");
12044
+ next("l");
12045
+ return null;
12046
+ }
12047
+ error("Unexpected '" + ch + "'");
12048
+ };
12049
+
12050
+ var value; // Place holder for the value function.
12051
+
12052
+ var array = function () {
12053
+
12054
+ // Parse an array value.
12055
+
12056
+ var arr = [];
12057
+
12058
+ if (ch === "[") {
12059
+ next("[");
12060
+ white();
12061
+ if (ch === "]") {
12062
+ next("]");
12063
+ return arr; // empty array
12064
+ }
12065
+ while (ch) {
12066
+ arr.push(value());
12067
+ white();
12068
+ if (ch === "]") {
12069
+ next("]");
12070
+ return arr;
12071
+ }
12072
+ next(",");
12073
+ white();
12074
+ }
12075
+ }
12076
+ error("Bad array");
12077
+ };
12078
+
12079
+ var object = function () {
12080
+
12081
+ // Parse an object value.
12082
+
12083
+ var key;
12084
+ var obj = {};
12085
+
12086
+ if (ch === "{") {
12087
+ next("{");
12088
+ white();
12089
+ if (ch === "}") {
12090
+ next("}");
12091
+ return obj; // empty object
12092
+ }
12093
+ while (ch) {
12094
+ key = string();
12095
+ white();
12096
+ next(":");
12097
+ if (Object.hasOwnProperty.call(obj, key)) {
12098
+ error("Duplicate key '" + key + "'");
12099
+ }
12100
+ obj[key] = value();
12101
+ white();
12102
+ if (ch === "}") {
12103
+ next("}");
12104
+ return obj;
12105
+ }
12106
+ next(",");
12107
+ white();
12108
+ }
12109
+ }
12110
+ error("Bad object");
12111
+ };
12112
+
12113
+ value = function () {
12114
+
12115
+ // Parse a JSON value. It could be an object, an array, a string, a number,
12116
+ // or a word.
12117
+
12118
+ white();
12119
+ switch (ch) {
12120
+ case "{":
12121
+ return object();
12122
+ case "[":
12123
+ return array();
12124
+ case "\"":
12125
+ return string();
12126
+ case "-":
12127
+ return number();
12128
+ default:
12129
+ return (ch >= "0" && ch <= "9")
12130
+ ? number()
12131
+ : word();
12132
+ }
12133
+ };
12134
+
12135
+ // Return the json_parse function. It will have access to all of the above
12136
+ // functions and variables.
12137
+
12138
+ return function (source, reviver) {
12139
+ var result;
12140
+
12141
+ text = source;
12142
+ at = 0;
12143
+ ch = " ";
12144
+ result = value();
12145
+ white();
12146
+ if (ch) {
12147
+ error("Syntax error");
12148
+ }
12149
+
12150
+ // If there is a reviver function, we recursively walk the new structure,
12151
+ // passing each name/value pair to the reviver function for possible
12152
+ // transformation, starting with a temporary root object that holds the result
12153
+ // in an empty key. If there is not a reviver function, we simply return the
12154
+ // result.
12155
+
12156
+ return (typeof reviver === "function")
12157
+ ? (function walk(holder, key) {
12158
+ var k;
12159
+ var v;
12160
+ var val = holder[key];
12161
+ if (val && typeof val === "object") {
12162
+ for (k in val) {
12163
+ if (Object.prototype.hasOwnProperty.call(val, k)) {
12164
+ v = walk(val, k);
12165
+ if (v !== undefined) {
12166
+ val[k] = v;
12167
+ } else {
12168
+ delete val[k];
12169
+ }
12170
+ }
12171
+ }
12172
+ }
12173
+ return reviver.call(holder, key, val);
12174
+ }({"": result}, ""))
12175
+ : result;
12176
+ };
12177
+ }());
12178
+ /* Jison generated parser */
12179
+ var jsonlint = (function(){
12180
+ var parser = {trace: function trace() { },
12181
+ yy: {},
12182
+ symbols_: {"error":2,"JSONString":3,"STRING":4,"JSONNumber":5,"NUMBER":6,"JSONNullLiteral":7,"NULL":8,"JSONBooleanLiteral":9,"TRUE":10,"FALSE":11,"JSONText":12,"JSONValue":13,"EOF":14,"JSONObject":15,"JSONArray":16,"{":17,"}":18,"JSONMemberList":19,"JSONMember":20,":":21,",":22,"[":23,"]":24,"JSONElementList":25,"$accept":0,"$end":1},
12183
+ terminals_: {2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},
12184
+ productions_: [0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],
12185
+ performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
12186
+
12187
+ var $0 = $$.length - 1;
12188
+ switch (yystate) {
12189
+ case 1: // replace escaped characters with actual character
12190
+ this.$ = yytext.replace(/\\(\\|")/g, "$"+"1")
12191
+ .replace(/\\n/g,'\n')
12192
+ .replace(/\\r/g,'\r')
12193
+ .replace(/\\t/g,'\t')
12194
+ .replace(/\\v/g,'\v')
12195
+ .replace(/\\f/g,'\f')
12196
+ .replace(/\\b/g,'\b');
12197
+
12198
+ break;
12199
+ case 2:this.$ = Number(yytext);
12200
+ break;
12201
+ case 3:this.$ = null;
12202
+ break;
12203
+ case 4:this.$ = true;
12204
+ break;
12205
+ case 5:this.$ = false;
12206
+ break;
12207
+ case 6:return this.$ = $$[$0-1];
12208
+ case 13:this.$ = {};
12209
+ break;
12210
+ case 14:this.$ = $$[$0-1];
12211
+ break;
12212
+ case 15:this.$ = [$$[$0-2], $$[$0]];
12213
+ break;
12214
+ case 16:this.$ = {}; this.$[$$[$0][0]] = $$[$0][1];
12215
+ break;
12216
+ case 17:this.$ = $$[$0-2]; $$[$0-2][$$[$0][0]] = $$[$0][1];
12217
+ break;
12218
+ case 18:this.$ = [];
12219
+ break;
12220
+ case 19:this.$ = $$[$0-1];
12221
+ break;
12222
+ case 20:this.$ = [$$[$0]];
12223
+ break;
12224
+ case 21:this.$ = $$[$0-2]; $$[$0-2].push($$[$0]);
12225
+ break;
12226
+ }
12227
+ },
12228
+ table: [{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],
12229
+ defaultActions: {16:[2,6]},
12230
+ parseError: function parseError(str, hash) {
12231
+ throw new Error(str);
12232
+ },
12233
+ parse: function parse(input) {
12234
+ var self = this,
12235
+ stack = [0],
12236
+ vstack = [null], // semantic value stack
12237
+ lstack = [], // location stack
12238
+ table = this.table,
12239
+ yytext = '',
12240
+ yylineno = 0,
12241
+ yyleng = 0,
12242
+ recovering = 0,
12243
+ TERROR = 2,
12244
+ EOF = 1;
12245
+
12246
+ //this.reductionCount = this.shiftCount = 0;
12247
+
12248
+ this.lexer.setInput(input);
12249
+ this.lexer.yy = this.yy;
12250
+ this.yy.lexer = this.lexer;
12251
+ if (typeof this.lexer.yylloc == 'undefined')
12252
+ this.lexer.yylloc = {};
12253
+ var yyloc = this.lexer.yylloc;
12254
+ lstack.push(yyloc);
12255
+
12256
+ if (typeof this.yy.parseError === 'function')
12257
+ this.parseError = this.yy.parseError;
12258
+
12259
+ function popStack (n) {
12260
+ stack.length = stack.length - 2*n;
12261
+ vstack.length = vstack.length - n;
12262
+ lstack.length = lstack.length - n;
12263
+ }
12264
+
12265
+ function lex() {
12266
+ var token;
12267
+ token = self.lexer.lex() || 1; // $end = 1
12268
+ // if token isn't its numeric value, convert
12269
+ if (typeof token !== 'number') {
12270
+ token = self.symbols_[token] || token;
12271
+ }
12272
+ return token;
12273
+ }
12274
+
12275
+ var symbol, preErrorSymbol, state, action, r, yyval={},p,len,newState, expected;
12276
+ while (true) {
12277
+ // retreive state number from top of stack
12278
+ state = stack[stack.length-1];
12279
+
12280
+ // use default actions if available
12281
+ if (this.defaultActions[state]) {
12282
+ action = this.defaultActions[state];
12283
+ } else {
12284
+ if (symbol == null)
12285
+ symbol = lex();
12286
+ // read action for current state and first input
12287
+ action = table[state] && table[state][symbol];
12288
+ }
12289
+
12290
+ // handle parse error
12291
+ if (typeof action === 'undefined' || !action.length || !action[0]) {
12292
+
12293
+ if (!recovering) {
12294
+ // Report error
12295
+ expected = [];
12296
+ for (p in table[state]) if (this.terminals_[p] && p > 2) {
12297
+ expected.push("'"+this.terminals_[p]+"'");
12298
+ }
12299
+ var errStr = '';
12300
+ if (this.lexer.showPosition) {
12301
+ errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'";
12302
+ } else {
12303
+ errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " +
12304
+ (symbol == 1 /*EOF*/ ? "end of input" :
12305
+ ("'"+(this.terminals_[symbol] || symbol)+"'"));
12306
+ }
12307
+ this.parseError(errStr,
12308
+ {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
12309
+ }
12310
+
12311
+ // just recovered from another error
12312
+ if (recovering == 3) {
12313
+ if (symbol == EOF) {
12314
+ throw new Error(errStr || 'Parsing halted.');
12315
+ }
12316
+
12317
+ // discard current lookahead and grab another
12318
+ yyleng = this.lexer.yyleng;
12319
+ yytext = this.lexer.yytext;
12320
+ yylineno = this.lexer.yylineno;
12321
+ yyloc = this.lexer.yylloc;
12322
+ symbol = lex();
12323
+ }
12324
+
12325
+ // try to recover from error
12326
+ while (1) {
12327
+ // check for error recovery rule in this state
12328
+ if ((TERROR.toString()) in table[state]) {
12329
+ break;
12330
+ }
12331
+ if (state == 0) {
12332
+ throw new Error(errStr || 'Parsing halted.');
12333
+ }
12334
+ popStack(1);
12335
+ state = stack[stack.length-1];
12336
+ }
12337
+
12338
+ preErrorSymbol = symbol; // save the lookahead token
12339
+ symbol = TERROR; // insert generic error symbol as new lookahead
12340
+ state = stack[stack.length-1];
12341
+ action = table[state] && table[state][TERROR];
12342
+ recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
12343
+ }
12344
+
12345
+ // this shouldn't happen, unless resolve defaults are off
12346
+ if (action[0] instanceof Array && action.length > 1) {
12347
+ throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
12348
+ }
12349
+
12350
+ switch (action[0]) {
12351
+
12352
+ case 1: // shift
12353
+ //this.shiftCount++;
12354
+
12355
+ stack.push(symbol);
12356
+ vstack.push(this.lexer.yytext);
12357
+ lstack.push(this.lexer.yylloc);
12358
+ stack.push(action[1]); // push state
12359
+ symbol = null;
12360
+ if (!preErrorSymbol) { // normal execution/no error
12361
+ yyleng = this.lexer.yyleng;
12362
+ yytext = this.lexer.yytext;
12363
+ yylineno = this.lexer.yylineno;
12364
+ yyloc = this.lexer.yylloc;
12365
+ if (recovering > 0)
12366
+ recovering--;
12367
+ } else { // error just occurred, resume old lookahead f/ before error
12368
+ symbol = preErrorSymbol;
12369
+ preErrorSymbol = null;
12370
+ }
12371
+ break;
12372
+
12373
+ case 2: // reduce
12374
+ //this.reductionCount++;
12375
+
12376
+ len = this.productions_[action[1]][1];
12377
+
12378
+ // perform semantic action
12379
+ yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
12380
+ // default location, uses first token for firsts, last for lasts
12381
+ yyval._$ = {
12382
+ first_line: lstack[lstack.length-(len||1)].first_line,
12383
+ last_line: lstack[lstack.length-1].last_line,
12384
+ first_column: lstack[lstack.length-(len||1)].first_column,
12385
+ last_column: lstack[lstack.length-1].last_column
12386
+ };
12387
+ r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
12388
+
12389
+ if (typeof r !== 'undefined') {
12390
+ return r;
12391
+ }
12392
+
12393
+ // pop off stack
12394
+ if (len) {
12395
+ stack = stack.slice(0,-1*len*2);
12396
+ vstack = vstack.slice(0, -1*len);
12397
+ lstack = lstack.slice(0, -1*len);
12398
+ }
12399
+
12400
+ stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
12401
+ vstack.push(yyval.$);
12402
+ lstack.push(yyval._$);
12403
+ // goto new state = table[STATE][NONTERMINAL]
12404
+ newState = table[stack[stack.length-2]][stack[stack.length-1]];
12405
+ stack.push(newState);
12406
+ break;
12407
+
12408
+ case 3: // accept
12409
+ return true;
12410
+ }
12411
+
12412
+ }
12413
+
12414
+ return true;
12415
+ }};
12416
+ /* Jison generated lexer */
12417
+ var lexer = (function(){
12418
+ var lexer = ({EOF:1,
12419
+ parseError:function parseError(str, hash) {
12420
+ if (this.yy.parseError) {
12421
+ this.yy.parseError(str, hash);
12422
+ } else {
12423
+ throw new Error(str);
12424
+ }
12425
+ },
12426
+ setInput:function (input) {
12427
+ this._input = input;
12428
+ this._more = this._less = this.done = false;
12429
+ this.yylineno = this.yyleng = 0;
12430
+ this.yytext = this.matched = this.match = '';
12431
+ this.conditionStack = ['INITIAL'];
12432
+ this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
12433
+ return this;
12434
+ },
12435
+ input:function () {
12436
+ var ch = this._input[0];
12437
+ this.yytext+=ch;
12438
+ this.yyleng++;
12439
+ this.match+=ch;
12440
+ this.matched+=ch;
12441
+ var lines = ch.match(/\n/);
12442
+ if (lines) this.yylineno++;
12443
+ this._input = this._input.slice(1);
12444
+ return ch;
12445
+ },
12446
+ unput:function (ch) {
12447
+ this._input = ch + this._input;
12448
+ return this;
12449
+ },
12450
+ more:function () {
12451
+ this._more = true;
12452
+ return this;
12453
+ },
12454
+ less:function (n) {
12455
+ this._input = this.match.slice(n) + this._input;
12456
+ },
12457
+ pastInput:function () {
12458
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
12459
+ return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
12460
+ },
12461
+ upcomingInput:function () {
12462
+ var next = this.match;
12463
+ if (next.length < 20) {
12464
+ next += this._input.substr(0, 20-next.length);
12465
+ }
12466
+ return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
12467
+ },
12468
+ showPosition:function () {
12469
+ var pre = this.pastInput();
12470
+ var c = new Array(pre.length + 1).join("-");
12471
+ return pre + this.upcomingInput() + "\n" + c+"^";
12472
+ },
12473
+ next:function () {
12474
+ if (this.done) {
12475
+ return this.EOF;
12476
+ }
12477
+ if (!this._input) this.done = true;
12478
+
12479
+ var token,
12480
+ match,
12481
+ tempMatch,
12482
+ index,
12483
+ lines;
12484
+ if (!this._more) {
12485
+ this.yytext = '';
12486
+ this.match = '';
12487
+ }
12488
+ var rules = this._currentRules();
12489
+ for (var i=0;i < rules.length; i++) {
12490
+ tempMatch = this._input.match(this.rules[rules[i]]);
12491
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
12492
+ match = tempMatch;
12493
+ index = i;
12494
+ if (!this.options.flex) break;
12495
+ }
12496
+ }
12497
+ if (match) {
12498
+ lines = match[0].match(/\n.*/g);
12499
+ if (lines) this.yylineno += lines.length;
12500
+ this.yylloc = {first_line: this.yylloc.last_line,
12501
+ last_line: this.yylineno+1,
12502
+ first_column: this.yylloc.last_column,
12503
+ last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length};
12504
+ this.yytext += match[0];
12505
+ this.match += match[0];
12506
+ this.yyleng = this.yytext.length;
12507
+ this._more = false;
12508
+ this._input = this._input.slice(match[0].length);
12509
+ this.matched += match[0];
12510
+ token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
12511
+ if (this.done && this._input) this.done = false;
12512
+ if (token) return token;
12513
+ else return;
12514
+ }
12515
+ if (this._input === "") {
12516
+ return this.EOF;
12517
+ } else {
12518
+ this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
12519
+ {text: "", token: null, line: this.yylineno});
12520
+ }
12521
+ },
12522
+ lex:function lex() {
12523
+ var r = this.next();
12524
+ if (typeof r !== 'undefined') {
12525
+ return r;
12526
+ } else {
12527
+ return this.lex();
12528
+ }
12529
+ },
12530
+ begin:function begin(condition) {
12531
+ this.conditionStack.push(condition);
12532
+ },
12533
+ popState:function popState() {
12534
+ return this.conditionStack.pop();
12535
+ },
12536
+ _currentRules:function _currentRules() {
12537
+ return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
12538
+ },
12539
+ topState:function () {
12540
+ return this.conditionStack[this.conditionStack.length-2];
12541
+ },
12542
+ pushState:function begin(condition) {
12543
+ this.begin(condition);
12544
+ }});
12545
+ lexer.options = {};
12546
+ lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
12547
+ switch($avoiding_name_collisions) {
12548
+ case 0:/* skip whitespace */
12549
+ break;
12550
+ case 1:return 6
12551
+ case 2:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 4
12552
+ case 3:return 17
12553
+ case 4:return 18
12554
+ case 5:return 23
12555
+ case 6:return 24
12556
+ case 7:return 22
12557
+ case 8:return 21
12558
+ case 9:return 10
12559
+ case 10:return 11
12560
+ case 11:return 8
12561
+ case 12:return 14
12562
+ case 13:return 'INVALID'
12563
+ }
12564
+ };
12565
+ lexer.rules = [/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/];
12566
+ lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"inclusive":true}};
12567
+ return lexer;})();
12568
+ parser.lexer = lexer;
12569
+ return parser;
12570
+ })();
12571
+
12572
+ var origParse = jsonlint.parse;
12573
+
12574
+ jsonlint.parse = function(input) {
12575
+ var result = origParse.call(jsonlint, input);
12576
+ var dougJSONParse = typeof ___dougJSONParse === 'undefined' ? require('./doug-json-parse') : ___dougJSONParse;
12577
+ try {
12578
+ dougJSONParse(input);
12579
+ } catch(e) {
12580
+ if(/Duplicate key|Bad string|Unexpected/.test(e.message)) {
12581
+ var linesUntilError = input.substring(0, e.at).split('\n');
12582
+ var line = linesUntilError.length;
12583
+ var col = linesUntilError[line - 1].length - 1;
12584
+
12585
+ this.parseError(e.message, {line: line, col: col, message: e.message.replace(/./, function(l) { return l.toLowerCase(); })});
12586
+ throw SyntaxError(e.message + ' on line ' + line);
12587
+ }
12588
+ }
12589
+
12590
+ return result;
12591
+ };
12592
+
12593
+ if (typeof exports !== 'undefined') {
12594
+ exports.parser = jsonlint;
12595
+ exports.parse = function () { return jsonlint.parse.apply(jsonlint, arguments); };
12596
+ exports.main = function commonjsMain(args) {
12597
+ if (!args[1])
12598
+ throw new Error('Usage: '+args[0]+' FILE');
12599
+ if (typeof process !== 'undefined') {
12600
+ var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
12601
+ } else {
12602
+ var cwd = require("file").path(require("file").cwd());
12603
+ var source = cwd.join(args[1]).read({charset: "utf-8"});
12604
+ }
12605
+ return exports.parser.parse(source);
12606
+ };
12607
+ if (require.main === module) {
12608
+ exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
12609
+ }
12610
+ }
12611
+ return exports;})();if(module.exports) module.exports = jsonlint;
12612
+ });
12613
+
12614
+ const codeEditorCss = ".CodeMirror{font-family:monospace;height:300px;color:black;direction:ltr}.CodeMirror-lines{padding:4px 0;}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px;}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white;}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:black}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid black;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0 !important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:transparent}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:transparent}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{0%{}50%{background-color:transparent}100%{}}@-webkit-keyframes blink{0%{}50%{background-color:transparent}100%{}}@keyframes blink{0%{}50%{background-color:transparent}100%{}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3,.cm-s-default .cm-type{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:#f00}.cm-invalidchar{color:#f00}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255, 150, 0, .3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:white}.CodeMirror-scroll{overflow:scroll !important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:none;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none;outline:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:none !important;border:none !important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px;}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:0.1px;}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:none}.CodeMirror-scroll,.CodeMirror-sizer,.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255, 255, 0, .4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:none}.CodeMirror-lint-markers{width:16px}.CodeMirror-lint-tooltip{background-color:#ffd;border:1px solid black;border-radius:4px 4px 4px 4px;color:black;font-family:monospace;font-size:10pt;overflow:hidden;padding:2px 5px;position:fixed;white-space:pre;white-space:pre-wrap;z-index:100;max-width:600px;opacity:0;transition:opacity .4s;-moz-transition:opacity .4s;-webkit-transition:opacity .4s;-o-transition:opacity .4s;-ms-transition:opacity .4s}.CodeMirror-lint-mark{background-position:left bottom;background-repeat:repeat-x}.CodeMirror-lint-mark-warning{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=\")}.CodeMirror-lint-mark-error{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==\")}.CodeMirror-lint-marker{background-position:center center;background-repeat:no-repeat;cursor:pointer;display:inline-block;height:16px;width:16px;vertical-align:middle;position:relative}.CodeMirror-lint-message{padding-left:18px;background-position:top left;background-repeat:no-repeat}.CodeMirror-lint-marker-warning,.CodeMirror-lint-message-warning{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=\")}.CodeMirror-lint-marker-error,.CodeMirror-lint-message-error{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=\")}.CodeMirror-lint-marker-multiple{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC\");background-repeat:no-repeat;background-position:right bottom;width:100%;height:100%}.CodeMirror-lint-line-error{background-color:rgba(183, 76, 81, 0.08)}.CodeMirror-lint-line-warning{background-color:rgba(255, 211, 0, 0.1)}.CodeMirror-foldmarker{color:blue;text-shadow:#b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{cursor:pointer}.CodeMirror-foldgutter-open:after{content:\"\\25BE\"}.CodeMirror-foldgutter-folded:after{content:\"\\25B8\"}:host{display:flex;font-size:var(--code-editor-font-size, 0.875rem)}.editor{display:flex;align-items:stretch;width:100%}.editor.is-light-mode{--code-editor-neutral-text-color:var(--contrast-1100);--code-editor-background-color:var(--contrast-200);--code-editor-gutter-background-color:var(--contrast-300);--code-editor-line-number-text-color:var(--contrast-700);--code-editor-cursor-color:var(--color-amber-dark);--code-editor-selection-highlight-color:var(--color-cyan-default);--code-editor-selection-lowlight-color:var(--contrast-600)}.editor.is-light-mode .cm-attribute,.editor.is-light-mode .cm-property,.editor.is-light-mode .cm-keyword{color:rgb(var(--color-violet-light))}.editor.is-light-mode .cm-operator{color:rgb(var(--color-sky-dark))}.editor.is-light-mode .cm-variable{color:rgb(var(--color-pink-light))}.editor.is-light-mode .cm-variable-2{color:rgb(var(--contrast-1100))}.editor.is-light-mode .cm-variable-3,.editor.is-light-mode .cm-type{color:rgb(var(--color-amber-darker))}.editor.is-light-mode .cm-builtin,.editor.is-light-mode .cm-meta{color:rgb(var(--color-amber-default))}.editor.is-light-mode .cm-atom{color:rgb(var(--color-coral-default))}.editor.is-light-mode .cm-tag,.editor.is-light-mode .cm-number{color:rgb(var(--color-magenta-default))}.editor.is-light-mode .cm-def{color:rgb(var(--color-sky-default))}.editor.is-light-mode .cm-string{color:rgb(var(--color-green-dark))}.editor.is-light-mode .cm-string-2{color:rgb(var(--color-pink-default))}.editor.is-light-mode .cm-qualifier{color:rgb(var(--color-grass-default))}.editor.is-light-mode .cm-error{color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}.editor.is-light-mode .cm-comment{color:rgba(var(--code-editor-neutral-text-color), 0.7)}.editor.is-dark-mode{--code-editor-neutral-text-color:var(--contrast-200);--code-editor-background-color:var(--contrast-1600);--code-editor-gutter-background-color:var(--contrast-1500);--code-editor-line-number-text-color:var(--contrast-1000);--code-editor-cursor-color:var(--color-amber-default);--code-editor-selection-highlight-color:var(--color-cyan-light);--code-editor-selection-lowlight-color:var(--contrast-1700)}.editor.is-dark-mode .cm-attribute,.editor.is-dark-mode .cm-property,.editor.is-dark-mode .cm-keyword{color:rgb(var(--color-purple-lighter))}.editor.is-dark-mode .cm-operator{color:rgb(var(--color-sky-lighter))}.editor.is-dark-mode .cm-variable{color:rgb(var(--color-pink-light))}.editor.is-dark-mode .cm-variable-2{color:rgb(var(--contrast-300))}.editor.is-dark-mode .cm-variable-3,.editor.is-dark-mode .cm-type{color:rgb(var(--color-yellow-light))}.editor.is-dark-mode .cm-builtin,.editor.is-dark-mode .cm-meta{color:rgb(var(--color-amber-default))}.editor.is-dark-mode .cm-atom{color:rgb(var(--color-coral-light))}.editor.is-dark-mode .cm-tag,.editor.is-dark-mode .cm-number{color:rgb(var(--color-magenta-light))}.editor.is-dark-mode .cm-def{color:rgb(var(--color-sky-light))}.editor.is-dark-mode .cm-string{color:rgb(var(--color-lime-light))}.editor.is-dark-mode .cm-string-2{color:rgb(var(--color-pink-lighter))}.editor.is-dark-mode .cm-qualifier{color:rgb(var(--color-grass-light))}.editor.is-dark-mode .cm-error{color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}.editor.is-dark-mode .cm-comment{color:rgba(var(--code-editor-neutral-text-color), 0.4)}.editor.readonly .CodeMirror-focused .CodeMirror-cursors{visibility:visible !important}.cm-s-lime.CodeMirror{color:rgb(var(--code-editor-neutral-text-color));background-color:rgb(var(--code-editor-background-color));border-radius:0.25rem;height:auto;width:100%}.cm-s-lime .CodeMirror-scroll{max-height:var(--code-editor-max-height, 10rem)}.cm-s-lime.CodeMirror-focused div.CodeMirror-selected{background:rgba(var(--code-editor-selection-highlight-color), 0.15)}.cm-s-lime div.CodeMirror-selected{background:rgba(var(--code-editor-selection-highlight-color), 0.05)}.cm-s-lime .CodeMirror-gutters{background-color:rgb(var(--code-editor-gutter-background-color));color:rgb(var(--code-editor-line-number-text-color));border:none}.cm-s-lime .CodeMirror-guttermarker,.cm-s-lime .CodeMirror-guttermarker-subtle,.cm-s-lime .CodeMirror-linenumber{color:rgb(var(--code-editor-line-number-text-color))}.cm-s-lime .CodeMirror-cursor{border-left:1px solid rgb(var(--code-editor-cursor-color))}.editor.readonly .cm-s-lime .CodeMirror-cursor{border-color:rgba(var(--code-editor-neutral-text-color), 0.5);border-width:0.125rem}.cm-s-lime .CodeMirror-activeline-background{background:rgba(var(--code-editor-selection-lowlight-color), 0.5)}.cm-s-lime .CodeMirror-matchingbracket{font-weight:bold;color:rgb(var(--code-editor-neutral-text-color)) !important;background:rgba(var(--code-editor-selection-highlight-color), 0.15);position:relative}.cm-s-lime .CodeMirror-matchingbracket:before{content:\"_\";color:rgb(var(--code-editor-selection-highlight-color), 0.8);position:absolute;bottom:-0.4rem;left:0;right:0}.cm-s-lime .CodeMirror-lint-marker-error,.cm-s-lime .CodeMirror-lint-message-error{background-image:url(\"data:image/svg+xml; utf8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><defs/><path fill='rgb(255,255,255)' d='M7.219 5.781L5.78 7.22 14.563 16 5.78 24.781 7.22 26.22 16 17.437l8.781 8.782 1.438-1.438L17.437 16l8.782-8.781L24.78 5.78 16 14.563z'/></svg>\");background-color:rgb(var(--color-red-default));background-size:0.75rem;border-radius:50%}.cm-s-lime .CodeMirror-foldmarker{position:relative;transition:background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;box-shadow:var(--button-shadow-normal);color:transparent;text-shadow:none;padding:0 0.5rem;border-radius:1rem;background-image:url(\"data:image/svg+xml; utf8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' xml:space='preserve'><circle cx='16' cy='16' r='2'/><circle cx='26' cy='16' r='2'/><circle cx='6' cy='16' r='2'/></svg>\");background-size:contain;background-repeat:no-repeat;background-position:center}.cm-s-lime .CodeMirror-foldmarker:hover{box-shadow:var(--button-shadow-hovered)}.cm-s-lime .CodeMirror-foldmarker:active{box-shadow:var(--button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}.is-dark-mode .cm-s-lime .CodeMirror-foldmarker{background-color:rgb(var(--contrast-1200))}.cm-s-lime [class^=CodeMirror-foldgutter]{color:var(--code-editor-neutral-text-color);transition:opacity 0.2s ease;opacity:0.4}.cm-s-lime [class^=CodeMirror-foldgutter]:hover{opacity:1}.cm-s-lime .CodeMirror-foldgutter-folded{opacity:0.7}";
11037
12615
 
11038
12616
  const CodeEditor = class {
11039
12617
  constructor(hostRef) {
11040
12618
  registerInstance(this, hostRef);
11041
12619
  this.change = createEvent(this, "change", 7);
11042
- /**
11043
- * The code to be rendered
11044
- */
11045
- this.value = '';
11046
- /**
11047
- * Disables editing of the editor content
11048
- */
11049
- this.readonly = false;
11050
- /**
11051
- * Displays line numbers in the editor
11052
- */
11053
- this.lineNumbers = false;
11054
- /**
11055
- * Select color scheme for the editor
11056
- */
11057
- this.colorScheme = 'auto';
11058
12620
  this.handleChangeDarkMode = () => {
11059
12621
  if (this.colorScheme !== 'auto') {
11060
12622
  return;
@@ -11070,6 +12632,14 @@ const CodeEditor = class {
11070
12632
  }
11071
12633
  this.editor.refresh();
11072
12634
  };
12635
+ this.value = '';
12636
+ this.language = undefined;
12637
+ this.readonly = false;
12638
+ this.lineNumbers = false;
12639
+ this.fold = false;
12640
+ this.lint = false;
12641
+ this.colorScheme = 'auto';
12642
+ this.random = undefined;
11073
12643
  }
11074
12644
  connectedCallback() {
11075
12645
  this.observer = new ResizeObserver(this.handleResize);
@@ -11092,16 +12662,37 @@ const CodeEditor = class {
11092
12662
  }
11093
12663
  this.editor = this.createEditor();
11094
12664
  }
12665
+ watchValue(newValue) {
12666
+ if (!this.editor) {
12667
+ return;
12668
+ }
12669
+ const currentValue = this.editor.getValue();
12670
+ if (newValue === currentValue) {
12671
+ // Circuit breaker for when the change comes from the editor itself
12672
+ // The caret position will be reset without this
12673
+ return;
12674
+ }
12675
+ this.editor.getDoc().setValue(newValue || '');
12676
+ }
11095
12677
  createEditor() {
11096
12678
  const options = this.getOptions();
11097
12679
  const editor = codemirror(this.host.shadowRoot.querySelector('.editor'), options);
11098
12680
  editor.on('change', this.handleChange);
12681
+ // Replace tab with spaces and use the actual indent setting for
12682
+ // the space count
12683
+ editor.setOption('extraKeys', {
12684
+ Tab: (codeMirror) => {
12685
+ const spaces = Array(codeMirror.getOption('indentUnit') + 1).join(' ');
12686
+ codeMirror.replaceSelection(spaces);
12687
+ },
12688
+ });
11099
12689
  return editor;
11100
12690
  }
11101
12691
  getOptions() {
11102
12692
  let mode = this.language;
11103
12693
  const TAB_SIZE = 4;
11104
12694
  let theme = 'lime light';
12695
+ const gutters = [];
11105
12696
  if (this.isDarkMode()) {
11106
12697
  theme = 'lime dark';
11107
12698
  }
@@ -11110,6 +12701,13 @@ const CodeEditor = class {
11110
12701
  name: 'application/json',
11111
12702
  json: true,
11112
12703
  };
12704
+ if (this.lint) {
12705
+ gutters.push('CodeMirror-lint-markers');
12706
+ if (!('jsonlint' in window)) {
12707
+ // eslint-disable-next-line @typescript-eslint/dot-notation
12708
+ window['jsonlint'] = jsonlint_1;
12709
+ }
12710
+ }
11113
12711
  }
11114
12712
  else if (this.language === 'typescript') {
11115
12713
  mode = {
@@ -11117,9 +12715,12 @@ const CodeEditor = class {
11117
12715
  typescript: true,
11118
12716
  };
11119
12717
  }
12718
+ if (this.fold) {
12719
+ gutters.push('CodeMirror-foldgutter');
12720
+ }
11120
12721
  return {
11121
12722
  mode: mode,
11122
- value: this.value,
12723
+ value: this.value || '',
11123
12724
  theme: theme,
11124
12725
  readOnly: this.readonly,
11125
12726
  tabSize: TAB_SIZE,
@@ -11127,6 +12728,9 @@ const CodeEditor = class {
11127
12728
  lineNumbers: this.lineNumbers,
11128
12729
  styleActiveLine: true,
11129
12730
  matchBrackets: true,
12731
+ lint: this.lint,
12732
+ foldGutter: this.fold,
12733
+ gutters: gutters,
11130
12734
  };
11131
12735
  }
11132
12736
  isDarkMode() {
@@ -11151,6 +12755,9 @@ const CodeEditor = class {
11151
12755
  return matchMedia('(prefers-color-scheme: dark)');
11152
12756
  }
11153
12757
  get host() { return getElement(this); }
12758
+ static get watchers() { return {
12759
+ "value": ["watchValue"]
12760
+ }; }
11154
12761
  };
11155
12762
  CodeEditor.style = codeEditorCss;
11156
12763